From ac45a401711216ddb73f145dba8df61f279c8a2e Mon Sep 17 00:00:00 2001 From: mlogclub Date: Sun, 24 May 2026 09:41:16 +0800 Subject: [PATCH] feat: refactor dashboard pages to use new Dashboard components for improved structure and consistency --- web/app/dashboard/agent-run-logs/page.tsx | 80 +++++++-------- web/app/dashboard/agents/page.tsx | 85 ++++++++-------- web/app/dashboard/ai-agents/page.tsx | 92 +++++++++-------- web/app/dashboard/ai-configs/page.tsx | 98 +++++++++--------- web/app/dashboard/customers/page.tsx | 73 ++++++++------ web/app/dashboard/notifications/page.tsx | 53 +++++----- web/app/dashboard/skill-definition/page.tsx | 87 +++++++++------- web/app/dashboard/tickets/page.tsx | 104 +++++++++++--------- web/app/dashboard/users/page.tsx | 68 +++++++------ web/components/dashboard-page.tsx | 26 ----- 10 files changed, 393 insertions(+), 373 deletions(-) diff --git a/web/app/dashboard/agent-run-logs/page.tsx b/web/app/dashboard/agent-run-logs/page.tsx index 7b83ef8..a7d6f59 100644 --- a/web/app/dashboard/agent-run-logs/page.tsx +++ b/web/app/dashboard/agent-run-logs/page.tsx @@ -4,6 +4,11 @@ import { useCallback, useEffect, useMemo, useState } from "react" import { RefreshCwIcon, SearchIcon } from "lucide-react" import { toast } from "sonner" +import { + DashboardPage, + DashboardTableShell, + DashboardToolbar, +} from "@/components/dashboard-page" import { ListPagination } from "@/components/list-pagination" import { OptionCombobox } from "@/components/option-combobox" import { Badge } from "@/components/ui/badge" @@ -67,21 +72,6 @@ function actionBadgeVariant(action: string) { } } -function hitlBadgeVariant(status: string) { - switch (status) { - case "pending": - return "secondary" as const - case "confirmed": - return "default" as const - case "cancelled": - return "outline" as const - case "expired": - return "destructive" as const - default: - return "secondary" as const - } -} - export default function DashboardAgentRunLogsPage() { const [keywordInput, setKeywordInput] = useState("") const [plannedActionInput, setPlannedActionInput] = useState("all") @@ -174,8 +164,20 @@ export default function DashboardAgentRunLogsPage() { return ( <> -
-
+ + void loadData()} + disabled={loading} + className="w-full xl:w-auto" + > + + 刷新 + + } + >
查询 - -
+
-
+ { + setLimit(nextLimit) + setPage(1) + }} + /> + } + > {!loading && result.results.length === 0 ? (
暂无 Agent 运行日志 @@ -352,21 +359,8 @@ export default function DashboardAgentRunLogsPage() {
)} -
- { - setLimit(nextLimit) - setPage(1) - }} - /> -
-
-
+ +
-
-
-
- {selectedTeam ? selectedTeam.name : "客服档案"} -
-
-
-
+ + + 新建 + + } + > +
setAgentCodeInput(event.target.value)} onKeyDown={handleFilterKeyDown} placeholder="按客服工号筛选" - className="w-full xl:w-48" + className="w-full sm:w-44" /> setNameInput(event.target.value)} onKeyDown={handleFilterKeyDown} placeholder="按名称筛选" - className="w-full xl:w-56" + className="w-full sm:w-56" /> -
+
查询 - - -
+ -
+ setPage(nextPage)} + onLimitChange={(nextLimit) => { + setLimit(nextLimit); + setPage(1); + }} + /> + } + > - {result.results.length === 0 ? ( - - - {loading ? "正在加载 AI Agent..." : "暂无 AI Agent"} - - + {loading || result.results.length === 0 ? ( + ) : null} item.id)} @@ -536,20 +558,8 @@ export default function DashboardAIAgentsPage() { -
- setPage(nextPage)} - onLimitChange={(nextLimit) => { - setLimit(nextLimit); - setPage(1); - }} - /> -
-
-
+ + -
-
-
+ + + + + + } + > +
-
+
-
+
-
+
查询 - - -
+ -
+ + } + > - {loading ? ( - - - 正在加载 AI 配置... - - - ) : result.results.length === 0 ? ( - - - 暂无 AI 配置数据 - - + {loading || result.results.length === 0 ? ( + ) : ( item.id)} @@ -617,16 +627,8 @@ export default function DashboardAIConfigsPage() { -
- - -
+ + -
-
-
+ + + + 新建 + + } + > +
查询 - -
+
-
+ { + setLimit(nextLimit); + setPage(1); + }} + /> + } + > @@ -341,15 +364,13 @@ export default function DashboardCustomersPage() { - {result.results.length === 0 && !loading ? ( - - - 暂无客户数据 - - + {loading || result.results.length === 0 ? ( + ) : ( result.results.map((item) => { const actionLoading = actionLoadingId === item.id; @@ -441,20 +462,8 @@ export default function DashboardCustomersPage() { )}
-
- - { - setLimit(nextLimit); - setPage(1); - }} - /> -
+ + -
-
-

通知中心

-

- 查看工单、会话等业务流转提醒 -

-
-
+ + -
-
- -
+ + } + > {readStatusOptions.map((option) => (
+ -
+ + } + > {result.results.length > 0 ? (
{result.results.map((item) => { @@ -172,16 +182,7 @@ export default function DashboardNotificationsPage() { {loading ? "正在加载通知" : "暂无通知"}
)} -
- - -
+ + ) } diff --git a/web/app/dashboard/skill-definition/page.tsx b/web/app/dashboard/skill-definition/page.tsx index f00042a..66913fc 100644 --- a/web/app/dashboard/skill-definition/page.tsx +++ b/web/app/dashboard/skill-definition/page.tsx @@ -13,6 +13,12 @@ import { } from "lucide-react" import { toast } from "sonner" +import { + DashboardPage, + DashboardTableShell, + DashboardTableStateRow, + DashboardToolbar, +} from "@/components/dashboard-page" import { ListPagination } from "@/components/list-pagination" import { OptionCombobox } from "@/components/option-combobox" import { Badge } from "@/components/ui/badge" @@ -362,9 +368,22 @@ export default function DashboardSkillsPage() { return ( <> -
-
-
+ + + + + + } + > +
setCodeInput(event.target.value)} onKeyDown={handleFilterKeyDown} placeholder="按编码筛选" - className="w-full xl:w-56" + className="w-full sm:w-56" /> -
+
查询 - - -
+ -
-
+ { + setLimit(nextLimit) + setPage(1) + }} + /> + } + > @@ -417,12 +441,13 @@ export default function DashboardSkillsPage() { - {!loading && result.results.length === 0 ? ( - - - 没有匹配的 Skill - - + {loading || result.results.length === 0 ? ( + ) : null} {result.results.map((item) => (
-
- { - setLimit(nextLimit) - setPage(1) - }} - /> -
-
-
-
+ + -
-
-
- {quickViews.map((view) => ( - - ))} -
-
-
- - -
+ +
+ {quickViews.map((view) => ( + + ))}
-
+ + + + + } + > 查询 -
+ -
+ @@ -348,11 +353,12 @@ export default function TicketsPage() { {tickets.length === 0 ? ( - - - {loading ? "加载中..." : "暂无工单"} - - + ) : ( tickets.map((ticket) => ( @@ -408,7 +414,7 @@ export default function TicketsPage() { )}
-
+ -
+ ) } diff --git a/web/app/dashboard/users/page.tsx b/web/app/dashboard/users/page.tsx index 4ba3e5a..7697598 100644 --- a/web/app/dashboard/users/page.tsx +++ b/web/app/dashboard/users/page.tsx @@ -5,13 +5,19 @@ import { KeyRoundIcon, MoreHorizontalIcon, PlusIcon, - RefreshCwIcon, SearchIcon, ShieldIcon, UserRoundIcon, } from "lucide-react" import { toast } from "sonner" +import { + DashboardPage, + DashboardTableShell, + DashboardTableStateRow, + DashboardToolbar, +} from "@/components/dashboard-page" +import { ListPagination } from "@/components/list-pagination" import { assignUserRoles, createUser, @@ -45,7 +51,6 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { Input } from "@/components/ui/input" -import { ListPagination } from "@/components/list-pagination" import { Table, TableBody, @@ -294,13 +299,16 @@ export default function DashboardUsersPage() { return ( <> -
-
- -
+ + setCreatingOpen(true)} disabled={loading}> + + 添加用户 + + } + > +
查询 -
-
-
+ + + } + > @@ -428,26 +446,18 @@ export default function DashboardUsersPage() { ))} - {!loading && result.results.length === 0 ? ( - - - 没有匹配的用户数据 - - + {loading || result.results.length === 0 ? ( + ) : null}
-
- -
-
+ + -
-

{title}

- {description ? ( -
- {description} -
- ) : null} -
- {actions ? ( -
{actions}
- ) : null} -
- ) -} - export function DashboardToolbar({ className, actions,