From 3eaa130670a2ee55a5d99e563b3651dd324d467f Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 14 Sep 2026 20:45:23 +0800 Subject: [PATCH] refactor: delete TemplateGrid.tsx (#1899 #1900) --- .../template-library/TemplateGrid.tsx | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 apps/web/src/pages/templates/components/template-library/TemplateGrid.tsx diff --git a/apps/web/src/pages/templates/components/template-library/TemplateGrid.tsx b/apps/web/src/pages/templates/components/template-library/TemplateGrid.tsx deleted file mode 100644 index 9afedf0bb..000000000 --- a/apps/web/src/pages/templates/components/template-library/TemplateGrid.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import React from "react" -import { Pagination } from "antd" -import { InboxOutlined, LoadingOutlined, ExclamationCircleOutlined } from "@ant-design/icons" -import { TemplateCard } from "./TemplateCard" -import type { TemplateItem } from "@/api/templates" - -interface TemplateGridProps { - templates: TemplateItem[] - total: number - page: number - pageSize: number - isLoading: boolean - isError: boolean - errorMessage?: string - searchText: string - activeType: string - onPageChange: (page: number) => void - onPreview: (template: TemplateItem) => void - onToggleFavorite: (id: string, e: React.MouseEvent) => void - onUse: (template: TemplateItem) => void -} - -export const TemplateGrid: React.FC = ({ - templates, - total, - page, - pageSize, - isLoading, - isError, - errorMessage, - searchText, - activeType, - onPageChange, - onPreview, - onToggleFavorite, - onUse, -}) => { - // Loading 状态 - if (isLoading) { - return ( -
-
- -
-

加载模板中...

-
- ) - } - - // Error 状态 - if (isError) { - return ( -
-
- -
-

加载失败

-

{errorMessage || "网络异常,请稍后重试"}

-
- ) - } - - // 空状态 - if (templates.length === 0) { - const hasFilter = !!searchText || activeType !== "全部" - return ( -
-
- -
-

{hasFilter ? "未找到匹配的模板" : "暂无模板"}

-

{hasFilter ? "试试调整搜索条件或切换类型" : "点击上方「创建模板」开始创作"}

-
- ) - } - - return ( - <> -
- {templates.map((tpl) => ( - - ))} -
- - {/* 分页 */} - {total > pageSize && ( -
- `共 ${t} 个模板`} - onChange={onPageChange} - /> -
- )} - - ) -}