diff --git a/docs/design-system.md b/docs/design-system.md index 01da782..c9afae5 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -81,7 +81,7 @@ div.flex.h-dvh.flex-col ← (app)/layout.tsx ### 长列表(虚拟滚动) -资源库使用 TanStack Virtual(`src/app/(app)/components/library-list.tsx`),同样不使用定位: +资源库使用 TanStack Virtual(`src/app/(app)/components/library/library-list.tsx`),同样不使用定位: - 滚动容器由页面持有(上面那个唯一的 `overflow-y-auto`),虚拟器只计算该渲染哪些行。 - 分组数据拍平成「提示 / 标题 / 一行卡片 / 空提示」四种行;可见行处于正常文档流,上下各一个占位 `div` 用 `height` 撑出未渲染部分。 @@ -185,7 +185,7 @@ div.flex.h-dvh.flex-col ← (app)/layout.tsx | 页面组件 | `library-list`、`file-card`、`login-stage` 等 | 只做接线:传选择器、参数与回调 | - 容器级交互 hook 统一签名 `useXxx(containerRef, options)`,在容器上做事件委托,彼此独立;删掉一行调用即可拆掉一个交互。 -- 目标靠 data 属性识别(`src/app/(app)/components/library-dom.ts`):`data-file-card` 网格单元、`data-card-focus` 卡片主操作、虚拟行 `data-index`。 +- 目标靠 data 属性识别(`src/app/(app)/components/library/library-dom.ts`):`data-file-card` 网格单元、`data-card-focus` 卡片主操作、虚拟行 `data-index`。 - 表单等业务组件只通过回调对外通知(如 `LoginForm` 的 `onTyping / onReject / onAccept`),不知道外部如何呈现。 ### 交互清单 diff --git a/src/app/(app)/components/add-magnet-panel.tsx b/src/app/(app)/components/add-resource/add-magnet-panel.tsx similarity index 100% rename from src/app/(app)/components/add-magnet-panel.tsx rename to src/app/(app)/components/add-resource/add-magnet-panel.tsx diff --git a/src/app/(app)/components/add-resource-button.tsx b/src/app/(app)/components/add-resource/add-resource-button.tsx similarity index 100% rename from src/app/(app)/components/add-resource-button.tsx rename to src/app/(app)/components/add-resource/add-resource-button.tsx diff --git a/src/app/(app)/components/add-resource-dialog.tsx b/src/app/(app)/components/add-resource/add-resource-dialog.tsx similarity index 100% rename from src/app/(app)/components/add-resource-dialog.tsx rename to src/app/(app)/components/add-resource/add-resource-dialog.tsx diff --git a/src/app/(app)/components/search-panel.tsx b/src/app/(app)/components/add-resource/search-panel.tsx similarity index 100% rename from src/app/(app)/components/search-panel.tsx rename to src/app/(app)/components/add-resource/search-panel.tsx diff --git a/src/app/(app)/components/search-result-list.tsx b/src/app/(app)/components/add-resource/search-result-list.tsx similarity index 100% rename from src/app/(app)/components/search-result-list.tsx rename to src/app/(app)/components/add-resource/search-result-list.tsx diff --git a/src/app/(app)/components/search-result-toolbar.tsx b/src/app/(app)/components/add-resource/search-result-toolbar.tsx similarity index 100% rename from src/app/(app)/components/search-result-toolbar.tsx rename to src/app/(app)/components/add-resource/search-result-toolbar.tsx diff --git a/src/app/(app)/components/file-card.tsx b/src/app/(app)/components/file/file-card.tsx similarity index 99% rename from src/app/(app)/components/file-card.tsx rename to src/app/(app)/components/file/file-card.tsx index 3d831af..21d2dd5 100644 --- a/src/app/(app)/components/file-card.tsx +++ b/src/app/(app)/components/file/file-card.tsx @@ -38,7 +38,7 @@ import type { DownloadStatus } from "@/types/torbox"; import { buildStreamUrl, toPotPlayerUrl, type MediaKind } from "@/utils/media"; import { ImageCover } from "./image-cover"; -import { CARD_FOCUS_PROPS } from "./library-dom"; +import { CARD_FOCUS_PROPS } from "../library/library-dom"; const ExtLabel = ({ ext }: { ext: string }) => ( {ext || "file"} diff --git a/src/app/(app)/components/file-grid.tsx b/src/app/(app)/components/file/file-grid.tsx similarity index 100% rename from src/app/(app)/components/file-grid.tsx rename to src/app/(app)/components/file/file-grid.tsx diff --git a/src/app/(app)/components/image-cover.tsx b/src/app/(app)/components/file/image-cover.tsx similarity index 100% rename from src/app/(app)/components/image-cover.tsx rename to src/app/(app)/components/file/image-cover.tsx diff --git a/src/app/(app)/components/app-header.tsx b/src/app/(app)/components/header/app-header.tsx similarity index 95% rename from src/app/(app)/components/app-header.tsx rename to src/app/(app)/components/header/app-header.tsx index 968a9e7..df02d6a 100644 --- a/src/app/(app)/components/app-header.tsx +++ b/src/app/(app)/components/header/app-header.tsx @@ -2,7 +2,7 @@ import { Badge } from "@/components/ui/badge"; import { Separator } from "@/components/ui/separator"; -import { AddResourceButton } from "./add-resource-button"; +import { AddResourceButton } from "../add-resource/add-resource-button"; import { HeaderBrand } from "./header-brand"; import { LogoutButton } from "./logout-button"; import { MobileMenu } from "./mobile-menu"; diff --git a/src/app/(app)/components/header-brand.tsx b/src/app/(app)/components/header/header-brand.tsx similarity index 100% rename from src/app/(app)/components/header-brand.tsx rename to src/app/(app)/components/header/header-brand.tsx diff --git a/src/app/(app)/components/logout-button.tsx b/src/app/(app)/components/header/logout-button.tsx similarity index 100% rename from src/app/(app)/components/logout-button.tsx rename to src/app/(app)/components/header/logout-button.tsx diff --git a/src/app/(app)/components/mobile-menu.tsx b/src/app/(app)/components/header/mobile-menu.tsx similarity index 98% rename from src/app/(app)/components/mobile-menu.tsx rename to src/app/(app)/components/header/mobile-menu.tsx index c8e0ffc..b3635fd 100644 --- a/src/app/(app)/components/mobile-menu.tsx +++ b/src/app/(app)/components/header/mobile-menu.tsx @@ -23,7 +23,7 @@ import { useLibraryFilterStore } from "@/stores/library-filter-store"; -import { LibraryFilters } from "./library-filters"; +import { LibraryFilters } from "../library/library-filters"; import { LogoutButton } from "./logout-button"; /** 只在菜单打开时挂载,来源计数不在后台重复计算 */ diff --git a/src/app/(app)/components/playlist-menu.tsx b/src/app/(app)/components/header/playlist-menu.tsx similarity index 100% rename from src/app/(app)/components/playlist-menu.tsx rename to src/app/(app)/components/header/playlist-menu.tsx diff --git a/src/app/(app)/components/delete-item-dialog.tsx b/src/app/(app)/components/item/delete-item-dialog.tsx similarity index 100% rename from src/app/(app)/components/delete-item-dialog.tsx rename to src/app/(app)/components/item/delete-item-dialog.tsx diff --git a/src/app/(app)/components/expiry-badge.tsx b/src/app/(app)/components/item/expiry-badge.tsx similarity index 100% rename from src/app/(app)/components/expiry-badge.tsx rename to src/app/(app)/components/item/expiry-badge.tsx diff --git a/src/app/(app)/components/item-download-status.tsx b/src/app/(app)/components/item/item-download-status.tsx similarity index 100% rename from src/app/(app)/components/item-download-status.tsx rename to src/app/(app)/components/item/item-download-status.tsx diff --git a/src/app/(app)/components/item-header.tsx b/src/app/(app)/components/item/item-header.tsx similarity index 100% rename from src/app/(app)/components/item-header.tsx rename to src/app/(app)/components/item/item-header.tsx diff --git a/src/app/(app)/components/new-badge.tsx b/src/app/(app)/components/item/new-badge.tsx similarity index 100% rename from src/app/(app)/components/new-badge.tsx rename to src/app/(app)/components/item/new-badge.tsx diff --git a/src/app/(app)/components/source-dot.tsx b/src/app/(app)/components/item/source-dot.tsx similarity index 100% rename from src/app/(app)/components/source-dot.tsx rename to src/app/(app)/components/item/source-dot.tsx diff --git a/src/app/(app)/components/back-to-top-button.tsx b/src/app/(app)/components/library/back-to-top-button.tsx similarity index 100% rename from src/app/(app)/components/back-to-top-button.tsx rename to src/app/(app)/components/library/back-to-top-button.tsx diff --git a/src/app/(app)/components/library-dom.ts b/src/app/(app)/components/library/library-dom.ts similarity index 100% rename from src/app/(app)/components/library-dom.ts rename to src/app/(app)/components/library/library-dom.ts diff --git a/src/app/(app)/components/library-filters.tsx b/src/app/(app)/components/library/library-filters.tsx similarity index 99% rename from src/app/(app)/components/library-filters.tsx rename to src/app/(app)/components/library/library-filters.tsx index b5f06bc..c09d2ec 100644 --- a/src/app/(app)/components/library-filters.tsx +++ b/src/app/(app)/components/library/library-filters.tsx @@ -14,7 +14,7 @@ import { } from "@/stores/library-filter-store"; import { formatCount } from "@/utils/format"; -import { SourceDot } from "./source-dot"; +import { SourceDot } from "../item/source-dot"; // 数字滚动过程中的格式化:计数取整 const formatInteger = (value: number) => formatCount(Math.round(value)); diff --git a/src/app/(app)/components/library-list.tsx b/src/app/(app)/components/library/library-list.tsx similarity index 98% rename from src/app/(app)/components/library-list.tsx rename to src/app/(app)/components/library/library-list.tsx index 80fc96e..79ceadd 100644 --- a/src/app/(app)/components/library-list.tsx +++ b/src/app/(app)/components/library/library-list.tsx @@ -37,11 +37,11 @@ import { import type { SourceType } from "@/types/torbox"; import type { MediaKind } from "@/utils/media"; -import { DeleteItemDialog } from "./delete-item-dialog"; -import { FileCard } from "./file-card"; -import { FileGrid, FileGridItem } from "./file-grid"; -import { ItemHeader } from "./item-header"; -import { LibraryImagePreview } from "./library-image-preview"; +import { DeleteItemDialog } from "../item/delete-item-dialog"; +import { FileCard } from "../file/file-card"; +import { FileGrid, FileGridItem } from "../file/file-grid"; +import { ItemHeader } from "../item/item-header"; +import { LibraryImagePreview } from "../preview/library-image-preview"; import { CARD_FOCUS_SELECTOR, CARD_PROPS, @@ -59,7 +59,7 @@ import { type LibraryRow, type RowPiece } from "./library-rows"; -import { LibraryVideoDialog } from "./library-video-dialog"; +import { LibraryVideoDialog } from "../preview/library-video-dialog"; import { SourceNotice } from "./source-notice"; /** 列表顶部留白;首个分组标题自带 8px 上留白,合计 20px */ diff --git a/src/app/(app)/components/library-rows.ts b/src/app/(app)/components/library/library-rows.ts similarity index 100% rename from src/app/(app)/components/library-rows.ts rename to src/app/(app)/components/library/library-rows.ts diff --git a/src/app/(app)/components/library-skeleton.tsx b/src/app/(app)/components/library/library-skeleton.tsx similarity index 94% rename from src/app/(app)/components/library-skeleton.tsx rename to src/app/(app)/components/library/library-skeleton.tsx index 9368b91..66412f8 100644 --- a/src/app/(app)/components/library-skeleton.tsx +++ b/src/app/(app)/components/library/library-skeleton.tsx @@ -1,7 +1,7 @@ // 资源列表加载骨架屏 import { Skeleton } from "@/components/ui/skeleton"; -import { FileGrid } from "./file-grid"; +import { FileGrid } from "../file/file-grid"; export const LibrarySkeleton = () => (
{ diff --git a/src/app/(app)/page.tsx b/src/app/(app)/page.tsx index 20612c6..02ffbac 100644 --- a/src/app/(app)/page.tsx +++ b/src/app/(app)/page.tsx @@ -3,7 +3,7 @@ import type { Metadata } from "next"; import { requireSessionToken } from "@/server/session"; -import { LibraryView } from "./components/library-view"; +import { LibraryView } from "./components/library/library-view"; export const metadata: Metadata = { title: "资源库"