Skip to content

Commit

Permalink
feat: date item in entry column (#199)
Browse files Browse the repository at this point in the history
* feat: date item in entry column

* chore: styles and mutation transaction wrapper

Signed-off-by: Innei <i@innei.in>

---------

Signed-off-by: Innei <i@innei.in>
Co-authored-by: Innei <i@innei.in>
  • Loading branch information
DIYgod and Innei authored Aug 4, 2024
1 parent 0f8309b commit 9d5a811
Show file tree
Hide file tree
Showing 14 changed files with 380 additions and 191 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"@electron-forge/plugin-fuses": "7.4.0",
"@electron-forge/publisher-github": "7.4.0",
"@electron-toolkit/tsconfig": "^1.0.1",
"@hono/node-server": "1.12.0",
"@iconify-json/mingcute": "1.1.18",
"@pengx17/electron-forge-maker-appimage": "1.2.1",
"@tailwindcss/container-queries": "0.1.1",
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 31 additions & 25 deletions src/hono.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import * as hono_hono_base from 'hono/hono-base';
import * as hono_utils_http_status from 'hono/utils/http-status';
import * as hono from 'hono';
import * as hono_types from 'hono/types';
import { HttpBindings } from '@hono/node-server';
import * as drizzle_orm from 'drizzle-orm';
import { InferInsertModel } from 'drizzle-orm';
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
import * as zod from 'zod';
import { z } from 'zod';

type Env = {
Bindings: HttpBindings;
};

declare const actions: drizzle_orm_pg_core.PgTableWithColumns<{
name: "actions";
schema: undefined;
Expand Down Expand Up @@ -2424,7 +2428,7 @@ declare const feedPowerTokensRelations: drizzle_orm.Relations<"feedPowerTokens",
feed: drizzle_orm.One<"feeds", true>;
}>;

declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
declare const _routes: hono_hono_base.HonoBase<Env, {
"/metrics": {
$get: {
input: {
Expand All @@ -2433,6 +2437,7 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
data: number[];
count: number;
Expand All @@ -2442,7 +2447,6 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
prevCount: number;
};
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2457,6 +2461,7 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
name: string | null;
id: string;
Expand All @@ -2466,7 +2471,6 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
handle: string | null;
createdAt: string;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2477,8 +2481,8 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
$post: {
input: {};
output: {
data: string;
code: 0;
data: string;
};
outputFormat: "json";
status: 200;
Expand Down Expand Up @@ -2509,10 +2513,10 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
transactionHash: string;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2532,6 +2536,7 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
type: "tip" | "mint" | "burn" | "withdraw";
createdAt: string;
Expand Down Expand Up @@ -2575,7 +2580,6 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
ownerUserId: string | null;
} | null;
}[];
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2585,10 +2589,10 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
$post: {
input: {};
output: {
code: 0;
data: {
transactionHash: string;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2598,10 +2602,10 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
$get: {
input: {};
output: {
code: 0;
data: {
ttl: number;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2615,12 +2619,12 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
title: string | null;
id: string;
powerToken: string;
}[];
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2634,10 +2638,10 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
transactionHash: string;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2652,6 +2656,7 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
userId: string;
createdAt: string;
Expand All @@ -2660,14 +2665,14 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
dailyPowerToken: string;
cashablePowerToken: string;
}[];
code: 0;
};
outputFormat: "json";
status: 200;
};
$post: {
input: {};
output: {
code: 0;
data: {
userId: string;
createdAt: string;
Expand All @@ -2676,7 +2681,6 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
dailyPowerToken: string;
cashablePowerToken: string;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand Down Expand Up @@ -2819,10 +2823,10 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
[x: string]: number;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2835,6 +2839,8 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
view?: number | undefined;
feedId?: string | undefined;
feedIdList?: string[] | undefined;
startTime?: number | undefined;
endTime?: number | undefined;
};
};
output: {
Expand All @@ -2848,10 +2854,10 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
$get: {
input: {};
output: {
code: 0;
data: {
count: number;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -2866,8 +2872,8 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
data: boolean;
code: 0;
data: boolean;
};
outputFormat: "json";
status: 200;
Expand Down Expand Up @@ -2947,13 +2953,13 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
json: string;
xml: string;
description: string;
xml: string;
content: string;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand Down Expand Up @@ -2982,6 +2988,7 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
readCount: number;
feed: {
Expand Down Expand Up @@ -3009,7 +3016,6 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
isPrivate: boolean;
} | undefined;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand Down Expand Up @@ -3106,13 +3112,13 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
url: string;
routes: {
[x: string]: {
path: string;
example: string;
description: string;
name: string;
parameters: {
[x: string]: string;
};
path: string;
example: string;
name: string;
categories: string[];
maintainers: string[];
location: string;
Expand All @@ -3131,12 +3137,12 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
$post: {
input: {};
output: {
code: 0;
data: {
userId: string;
sessionToken: string;
expires: string;
};
code: 0;
};
outputFormat: "json";
status: 200;
Expand Down Expand Up @@ -3338,6 +3344,7 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
description: string | null;
title: string | null;
Expand Down Expand Up @@ -3365,7 +3372,6 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
size_in_bytes?: number | undefined;
}[] | null | undefined;
}[];
code: 0;
};
outputFormat: "json";
status: 200;
Expand All @@ -3381,6 +3387,7 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
};
};
output: {
code: 0;
data: {
title: string | null;
view: number;
Expand All @@ -3404,7 +3411,6 @@ declare const _routes: hono_hono_base.HonoBase<hono_types.BlankEnv, {
category: string | null;
isPrivate: boolean;
}[];
code: 0;
};
outputFormat: "json";
status: 200;
Expand Down
39 changes: 39 additions & 0 deletions src/renderer/src/modules/entry-column/date-item.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { FeedViewType } from "@renderer/lib/enum"
import { cn } from "@renderer/lib/utils"

import { MarkAllButton } from "./mark-all-button"
import { SocialMediaDateItem } from "./social-media-item"

export const DateItem = ({
date,
view,
isFirst,
}: {
date: string
view: FeedViewType
isFirst: boolean
}) => {
const dateObj = new Date(date)
const dateString = dateObj.toLocaleDateString("en-US", { weekday: "long", month: "short", day: "numeric" })
const startOfDay = new Date(dateObj.setHours(0, 0, 0, 0)).getTime()
const endOfDay = new Date(dateObj.setHours(23, 59, 59, 999)).getTime()

const className = cn(isFirst ? "pt-2" : "pt-8", "flex items-center gap-1 pl-2 text-sm font-bold text-zinc-800 dark:text-neutral-400")

if (view === FeedViewType.SocialMedia) {
return <SocialMediaDateItem date={date} className={className} />
}

return (
<div className={className}>
<MarkAllButton
className="size-7 text-base"
filter={{
startTime: startOfDay,
endTime: endOfDay,
}}
/>
{dateString}
</div>
)
}
Loading

0 comments on commit 9d5a811

Please sign in to comment.