From bd7b5e99e52c6b4bc160af57181aa470249759ea Mon Sep 17 00:00:00 2001 From: yjl9903 Date: Sun, 15 Sep 2024 23:38:28 +0800 Subject: [PATCH] feat(web): update resouces table --- .../web/app/components/Resources/table.tsx | 230 ++++++++++-------- .../web/app/components/Resources/tag.tsx | 6 +- apps/frontend/web/app/styles/main.css | 5 + apps/frontend/web/tsconfig.json | 1 + 4 files changed, 138 insertions(+), 104 deletions(-) diff --git a/apps/frontend/web/app/components/Resources/table.tsx b/apps/frontend/web/app/components/Resources/table.tsx index fc25f1df..0b1ee693 100644 --- a/apps/frontend/web/app/components/Resources/table.tsx +++ b/apps/frontend/web/app/components/Resources/table.tsx @@ -1,5 +1,6 @@ import type { Resource } from 'animegarden'; +import { memo } from 'react' import { formatInTimeZone } from 'date-fns-tz'; import { getPikPakUrlChecker } from '@/utils'; @@ -33,122 +34,147 @@ export default function ResourcesTable(props: ResourcesTableProps) {
- + {/* */} - - + + - - */} + - + {resources.map((r) => ( - - - - - - + ))}
+ {/* 发布时间 - - 标题 + +
+
+ +
+
资源
+
发布者播放 / 下载播放
- - {formatInTimeZone(new Date(r.createdAt), 'Asia/Shanghai', 'yyyy-MM-dd HH:mm')} - - -
-
- - {['動畫', '季度全集', '日劇', '特攝'].includes(r.type) ? ( - <> - - {r.title} - - - - ) : ( - - {r.title} - - )} - - - - -
-
-
-
- {r.fansub ? ( - - - - ) : r.publisher ? ( - - - - ) : null} -
-
- -
); } + +export const ResourceItem = memo((props: { resource: Resource<{ tracker: true }> }) => { + const { resource: r } = props; + + return + {/* + + {formatInTimeZone(new Date(r.createdAt), 'Asia/Shanghai', 'yyyy-MM-dd HH:mm')} + + */} + +
+
+
+ +
+
+
+
+
+ + {['動畫', '季度全集', '日劇', '特攝'].includes(r.type) ? ( + <> + + {r.title} + + + ) : ( + + {r.title} + + )} + +
+
+
+ {/* + + */} + 发布于 {formatInTimeZone(new Date(r.createdAt), 'Asia/Shanghai', 'yyyy-MM-dd HH:mm')} + 上传者 {r.publisher.name} + {r.fansub && 字幕组 {r.fansub?.name}} + 更多 +
+
+
+ + +
+ {r.fansub ? ( + + + + ) : r.publisher ? ( + + + + ) : null} +
+ + +
+ + + {/* {r.size} */} +
+ + +}); \ No newline at end of file diff --git a/apps/frontend/web/app/components/Resources/tag.tsx b/apps/frontend/web/app/components/Resources/tag.tsx index 49f8dcb6..19f73887 100644 --- a/apps/frontend/web/app/components/Resources/tag.tsx +++ b/apps/frontend/web/app/components/Resources/tag.tsx @@ -1,4 +1,6 @@ -export function Tag(props: { text: string; color?: string; className?: string }) { +import { memo } from 'react' + +export const Tag = memo((props: { text: string; color?: string; className?: string }) => { const { text, className = '', color = 'bg-gray-200' } = props; return ( @@ -12,4 +14,4 @@ export function Tag(props: { text: string; color?: string; className?: string }) {text} ); -} +}); diff --git a/apps/frontend/web/app/styles/main.css b/apps/frontend/web/app/styles/main.css index 8865a7b0..d13a0d06 100644 --- a/apps/frontend/web/app/styles/main.css +++ b/apps/frontend/web/app/styles/main.css @@ -11,6 +11,11 @@ @apply: text-sky-700 hover:text-sky-500; } +.text-link-secondary { + /* prettier-ignore */ + @apply: text-sky-700/60 hover:text-sky-500/60; +} + .text-link-active { /* prettier-ignore */ @apply: hover:text-sky-600; diff --git a/apps/frontend/web/tsconfig.json b/apps/frontend/web/tsconfig.json index c686ed07..05ee7270 100644 --- a/apps/frontend/web/tsconfig.json +++ b/apps/frontend/web/tsconfig.json @@ -1,4 +1,5 @@ { + "extends": "../../../tsconfig.json", "compilerOptions": { "lib": [ "DOM",