From fe5041191fb31811bc0a11f554dd4f8351f82542 Mon Sep 17 00:00:00 2001 From: mlogclub Date: Sun, 21 Jun 2026 10:09:52 +0800 Subject: [PATCH] refactor: standardize card styles and improve layout across dashboard components --- web/app/dashboard/_components/alert-list.tsx | 6 +-- .../dashboard/_components/dashboard-home.tsx | 38 +++++++++---------- .../dashboard/_components/summary-cards.tsx | 12 +++--- .../dashboard/_components/team-load-panel.tsx | 14 +++---- web/app/dashboard/_components/trend-panel.tsx | 4 +- .../dashboard/ai-agents/_components/edit.tsx | 6 +-- web/app/dashboard/channels/page.tsx | 2 +- web/app/dashboard/layout.tsx | 8 ++-- web/app/dashboard/permissions/page.tsx | 2 +- .../roles/_components/assign-permissions.tsx | 2 +- web/app/dashboard/roles/page.tsx | 2 +- .../_components/initial-password-dialog.tsx | 2 +- .../users/_components/reset-password.tsx | 2 +- web/app/dashboard/users/page.tsx | 2 +- web/components/dashboard-page.tsx | 17 +++++++-- web/components/dashboard-placeholder.tsx | 22 +++++------ web/components/nav-user.tsx | 14 +++++++ web/components/site-header.tsx | 8 ---- web/messages/en-US.json | 1 + web/messages/zh-CN.json | 1 + 20 files changed, 91 insertions(+), 74 deletions(-) diff --git a/web/app/dashboard/_components/alert-list.tsx b/web/app/dashboard/_components/alert-list.tsx index 4ffd41d..fffd391 100644 --- a/web/app/dashboard/_components/alert-list.tsx +++ b/web/app/dashboard/_components/alert-list.tsx @@ -32,14 +32,14 @@ export function AlertList({ alerts }: AlertListProps) { const t = useI18n() return ( - + {t("dashboardHome.riskAlerts")} {t("dashboardHome.riskAlertsDescription")} {alerts.length === 0 ? ( -
+
{t("dashboardHome.noRiskTitle")}
@@ -49,7 +49,7 @@ export function AlertList({ alerts }: AlertListProps) { ) : ( alerts.map((item) => ( -
+
diff --git a/web/app/dashboard/_components/dashboard-home.tsx b/web/app/dashboard/_components/dashboard-home.tsx index e299a68..d1e0bd1 100644 --- a/web/app/dashboard/_components/dashboard-home.tsx +++ b/web/app/dashboard/_components/dashboard-home.tsx @@ -22,8 +22,8 @@ function LoadingCards() { return (
{Array.from({ length: 6 }).map((_, index) => ( - - + + @@ -72,7 +72,7 @@ export function DashboardHome() { ] return ( -
+

{t("dashboardHome.title")}

@@ -82,7 +82,7 @@ export function DashboardHome() {

-
+
{rangeOptions.map((item) => (
- + (
-
+
diff --git a/web/app/dashboard/layout.tsx b/web/app/dashboard/layout.tsx index 84d3522..d975b1e 100644 --- a/web/app/dashboard/layout.tsx +++ b/web/app/dashboard/layout.tsx @@ -35,9 +35,9 @@ export default function DashboardLayout({ if (!ready || !session) { return ( -
+
-
+
@@ -63,9 +63,9 @@ export default function DashboardLayout({ > - + -
+
{children}
diff --git a/web/app/dashboard/permissions/page.tsx b/web/app/dashboard/permissions/page.tsx index 152848c..4aebd5b 100644 --- a/web/app/dashboard/permissions/page.tsx +++ b/web/app/dashboard/permissions/page.tsx @@ -58,7 +58,7 @@ export default function DashboardPermissionsPage() { label: t("permission.columnPermission"), render: (item) => (
-
+
diff --git a/web/app/dashboard/roles/_components/assign-permissions.tsx b/web/app/dashboard/roles/_components/assign-permissions.tsx index 545d0f7..31e0384 100644 --- a/web/app/dashboard/roles/_components/assign-permissions.tsx +++ b/web/app/dashboard/roles/_components/assign-permissions.tsx @@ -191,7 +191,7 @@ function AssignPermissionsDrawerBody({ const value = field.value || []; return ( -
+
{loading ? (
{t("role.loadingPermissions")} diff --git a/web/app/dashboard/roles/page.tsx b/web/app/dashboard/roles/page.tsx index b313bc1..72ebd3a 100644 --- a/web/app/dashboard/roles/page.tsx +++ b/web/app/dashboard/roles/page.tsx @@ -123,7 +123,7 @@ function SortableRoleRow({
-
+
{displayName}
diff --git a/web/app/dashboard/users/_components/initial-password-dialog.tsx b/web/app/dashboard/users/_components/initial-password-dialog.tsx index 6b65fd7..1e9dd69 100644 --- a/web/app/dashboard/users/_components/initial-password-dialog.tsx +++ b/web/app/dashboard/users/_components/initial-password-dialog.tsx @@ -56,7 +56,7 @@ export function InitialPasswordDialog({ {t("user.initialPasswordDescription", { username: username || "-" })} -
+
{t("user.initialPassword")}
{password}
diff --git a/web/app/dashboard/users/_components/reset-password.tsx b/web/app/dashboard/users/_components/reset-password.tsx index 28c40ff..ade90e1 100644 --- a/web/app/dashboard/users/_components/reset-password.tsx +++ b/web/app/dashboard/users/_components/reset-password.tsx @@ -86,7 +86,7 @@ export function ResetPasswordDialogs({ {t("user.resetSuccessDescription", { username: item?.username || "-" })} -
+
{t("user.newPassword")}
{password}
diff --git a/web/app/dashboard/users/page.tsx b/web/app/dashboard/users/page.tsx index 9c5fdbc..7c9222e 100644 --- a/web/app/dashboard/users/page.tsx +++ b/web/app/dashboard/users/page.tsx @@ -352,7 +352,7 @@ export default function DashboardUsersPage() {
-
+
diff --git a/web/components/dashboard-page.tsx b/web/components/dashboard-page.tsx index e15d59f..f77b3c8 100644 --- a/web/components/dashboard-page.tsx +++ b/web/components/dashboard-page.tsx @@ -1,10 +1,12 @@ "use client" import type { ReactNode } from "react" +import { usePathname } from "next/navigation" import { cn } from "@/lib/utils" import { TableCell, TableRow } from "@/components/ui/table" import { useI18n } from "@/i18n/provider" +import { getPageTitleKey } from "@/lib/navigation" export function DashboardPage({ className, @@ -13,8 +15,15 @@ export function DashboardPage({ className?: string children: ReactNode }) { + const t = useI18n() + const pathname = usePathname() + const title = t(getPageTitleKey(pathname)) + return ( -
+
+
+

{title}

+
{children}
) @@ -32,7 +41,7 @@ export function DashboardToolbar({ return (
@@ -56,8 +65,8 @@ export function DashboardTableShell({ children: ReactNode }) { return ( -
-
+
+
{children}
{pagination ?
{pagination}
: null} diff --git a/web/components/dashboard-placeholder.tsx b/web/components/dashboard-placeholder.tsx index b5db2f8..5b5a27a 100644 --- a/web/components/dashboard-placeholder.tsx +++ b/web/components/dashboard-placeholder.tsx @@ -28,25 +28,25 @@ export function DashboardPlaceholder({ const t = useI18n() return ( -
- - - +
+ + + {eyebrow} - {title} + {title} {description} - -
+ +

{t("placeholder.nextSteps")}

-
+
{nextSteps.map((item) => (

{item}

@@ -54,14 +54,14 @@ export function DashboardPlaceholder({ ))}
-
+

{t("placeholder.status")}

{t("placeholder.statusDescription")}

- diff --git a/web/components/nav-user.tsx b/web/components/nav-user.tsx index 0f7772a..e4ddec9 100644 --- a/web/components/nav-user.tsx +++ b/web/components/nav-user.tsx @@ -6,7 +6,10 @@ import { useState } from "react" import { useAuth } from "@/components/auth-provider" import { useI18n } from "@/i18n/provider" import { ChangePasswordDialog } from "@/components/change-password-dialog" +import { LocaleSwitcher } from "@/components/locale-switcher" import { useNotifications } from "@/components/notification-provider" +import { PaletteToggle } from "@/components/palette-toggle" +import { ThemeToggle } from "@/components/theme-toggle" import { Badge } from "@/components/ui/badge" import { Avatar, @@ -96,6 +99,17 @@ export function NavUser({ + + + {t("nav.preferences")} + +
+ + + +
+
+ { diff --git a/web/components/site-header.tsx b/web/components/site-header.tsx index 0b01d99..5330ad6 100644 --- a/web/components/site-header.tsx +++ b/web/components/site-header.tsx @@ -3,13 +3,10 @@ import { useEffect, useRef } from "react" import { usePathname } from "next/navigation" -import { LocaleSwitcher } from "@/components/locale-switcher" import { RealtimeConnectionStatus } from "@/components/realtime-connection-status" import { useI18n } from "@/i18n/provider" import { getPageTitleKey } from "@/lib/navigation" import { useAgentConversationsStore } from "@/lib/stores/agent-conversations" -import { PaletteToggle } from "@/components/palette-toggle" -import { ThemeToggle } from "@/components/theme-toggle" import { Breadcrumb, BreadcrumbItem, @@ -77,11 +74,6 @@ export function SiteHeader() {
-
- - - -
) diff --git a/web/messages/en-US.json b/web/messages/en-US.json index 0d79e73..df79cd6 100644 --- a/web/messages/en-US.json +++ b/web/messages/en-US.json @@ -2343,6 +2343,7 @@ "permissions": "Permissions", "dashboardHome": "Dashboard", "notifications": "Notifications", + "preferences": "Preferences", "changePassword": "Change Password", "signOut": "Sign Out" }, diff --git a/web/messages/zh-CN.json b/web/messages/zh-CN.json index 49dba23..b33688e 100644 --- a/web/messages/zh-CN.json +++ b/web/messages/zh-CN.json @@ -2343,6 +2343,7 @@ "permissions": "权限管理", "dashboardHome": "后台总览", "notifications": "通知中心", + "preferences": "偏好设置", "changePassword": "修改密码", "signOut": "退出登录" },