From 981d751c3bb1c8b53750c3d6d336e99032e69f53 Mon Sep 17 00:00:00 2001 From: saltbo Date: Thu, 9 Jul 2026 14:02:38 -0400 Subject: [PATCH] Reapply "fix(admin): refine dashboard card styling" This reverts commit 12209dde61632b523f2c4714fbe6e7887400d3c6. --- src/routes/_authenticated/admin/index.tsx | 178 +++++++++++++--------- 1 file changed, 109 insertions(+), 69 deletions(-) diff --git a/src/routes/_authenticated/admin/index.tsx b/src/routes/_authenticated/admin/index.tsx index b04c74b4..c4cfa0c1 100644 --- a/src/routes/_authenticated/admin/index.tsx +++ b/src/routes/_authenticated/admin/index.tsx @@ -52,7 +52,6 @@ import { Button } from '@/components/ui/button' import { Calendar } from '@/components/ui/calendar' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover' -import { Progress } from '@/components/ui/progress' import { Skeleton } from '@/components/ui/skeleton' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table' import { useEntitlement } from '@/hooks/useEntitlement' @@ -78,6 +77,8 @@ type SectionId = 'overview' | 'growth' | 'storage' | 'traffic' | 'sharing' | 'ra const SECTION_ORDER: SectionId[] = ['overview', 'growth', 'storage', 'traffic', 'sharing', 'ranking'] const CHART_COLORS = ['#0f766e', '#0369a1', '#b45309', '#7c3aed', '#be123c', '#64748b', '#0284c7', '#15803d'] +const DASHBOARD_SURFACE = + 'gap-0 rounded-lg border-border/60 bg-card py-0 shadow-[0_1px_2px_rgba(15,23,42,0.04),0_10px_24px_rgba(15,23,42,0.035)]' export function OverviewPage() { const today = useMemo(() => new Date(), []) @@ -142,7 +143,7 @@ export function OverviewPage() { } return ( -
+
void }) { return ( -
-
- {open && !locked && }
- {open &&
{children}
} + {open &&
{children}
}
) } @@ -256,7 +262,12 @@ function DateRangePicker({ value, onChange }: { value: DateRange; onChange: (ran return ( - @@ -820,13 +831,13 @@ function RankingSection({ stats }: { stats: AdminDashboardRankingStats }) {
{stats.topSpaces.map((space) => ( -
+
{space.orgName} {formatSize(space.usedBytes)}
- -

+ +

{space.orgType} · {formatPercent(space.utilization)}

@@ -860,28 +871,36 @@ function StatCard({ metrics?: Array<{ label: string; value: string }> }) { return ( - - -
-
-

{label}

-

{value}

+ + +
+
+

+ {label} +

+
+

{value}

+ {delta && ( + + {delta} + + )} +
- + + +
-
+
{metrics.slice(0, 2).map((metric) => ( -
-

{metric.label}

-

{metric.value}

+
+

{metric.label}

+

{metric.value}

))} - {delta && ( -
-

环比

-

{delta}

-
- )}
@@ -890,12 +909,12 @@ function StatCard({ function ChartCard({ title, subtitle, children }: { title: string; subtitle?: string; children: ReactNode }) { return ( - - - {title} - {subtitle &&

{subtitle}

} + + + {title} + {subtitle &&

{subtitle}

}
- {children} + {children}
) } @@ -932,8 +951,8 @@ function BreakdownChart({ }) { return ( -
-
+
+
@@ -978,7 +997,7 @@ function BreakdownRows({ return (
{rows.map((row, index) => ( -
+
{valueFormatter(row.value)}
- {row.percent !== undefined && } -

+ {row.percent !== undefined && ( + + )} +

{row.detail ?? (row.percent !== undefined ? `${formatPercent(row.percent)} of total` : '')}

@@ -1021,6 +1042,10 @@ function FunnelChart({ data }: { data: Array<{ name: string; value: number; perc sort: 'none', gap: 4, label: { + position: 'inside', + color: '#fff', + fontSize: 12, + fontWeight: 600, formatter: ({ name, value }: { name: string; value: number }) => `${labelize(name)} ${formatNumber(value)}`, }, @@ -1040,7 +1065,7 @@ function FunnelChart({ data }: { data: Array<{ name: string; value: number; perc chart.dispose() } }, [data]) - return
+ return
} function TopSharesTable({ rows }: { rows: AdminDashboardSharingStats['topShares'] }) { @@ -1049,37 +1074,50 @@ function TopSharesTable({ rows }: { rows: AdminDashboardSharingStats['topShares' {rows.length === 0 ? ( ) : ( - - - - 分享 - 创建者 - 访问 - 下载 - 占比 - - - - {rows.map((row) => ( - - - {row.name} - - - {row.creatorName} - - {formatNumber(row.views)} - {formatNumber(row.downloads)} - {formatPercent(row.viewPercent)} +
+
+ + + 分享 + 创建者 + 访问 + 下载 + 占比 - ))} - -
+ + + {rows.map((row) => ( + + + {row.name} + + + {row.creatorName} + + {formatNumber(row.views)} + {formatNumber(row.downloads)} + {formatPercent(row.viewPercent)} + + ))} + + +
)} ) } +function PercentBar({ value, color }: { value: number; color: string }) { + return ( +
+
+
+ ) +} + function QueryState({ query, children, @@ -1103,17 +1141,19 @@ function SectionSkeleton() {
{[1, 2, 3, 4].map((item) => ( - + ))}
- +
) } function EmptyState() { return ( -
暂无统计数据
+
+ 暂无统计数据 +
) }