diff --git a/ui/src/pages/home.tsx b/ui/src/pages/home.tsx index 50b879ad..17e87ed3 100644 --- a/ui/src/pages/home.tsx +++ b/ui/src/pages/home.tsx @@ -1,68 +1,38 @@ import { useNavigate } from 'react-router-dom'; -import { HeroSection } from '@/components/layout/hero-section'; +import { useTranslation } from 'react-i18next'; +import { + ActivityIcon, + AlertTriangle, + ArrowRight, + KeyIcon, + ScrollText, + ShieldCheck, + UsersIcon, + Zap, +} from 'lucide-react'; import { AuthMonitor } from '@/components/monitoring/auth-monitor'; import { ErrorLogsMonitor } from '@/components/error-logs-monitor'; import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'; +import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Skeleton } from '@/components/ui/skeleton'; -import { Key, Zap, Users, Activity, AlertTriangle, ArrowRight, ScrollText } from 'lucide-react'; import { useOverview } from '@/hooks/use-overview'; import { useSharedSummary } from '@/hooks/use-shared'; -import { cn } from '@/lib/utils'; -import type { LucideIcon } from 'lucide-react'; -import { useTranslation } from 'react-i18next'; +import { PageShell, PageHeader } from '@/components/page-shell'; +import { + MonitorLayout, + KpiRow, + KpiCard, + MonitorGrid, + MonitorCard, +} from '@/components/monitor-layout'; -const HEALTH_VARIANTS = { - ok: 'success', +const HEALTH_TONE = { + ok: 'positive', warning: 'warning', - error: 'error', + error: 'negative', } as const; -type StatVariant = 'default' | 'success' | 'warning' | 'error' | 'accent'; - -const variantStyles: Record = { - default: { iconBg: 'bg-muted', iconColor: 'text-muted-foreground' }, - success: { iconBg: 'bg-green-600/15', iconColor: 'text-green-700 dark:text-green-500' }, - warning: { iconBg: 'bg-amber-500/15', iconColor: 'text-amber-700 dark:text-amber-400' }, - error: { iconBg: 'bg-red-600/15', iconColor: 'text-red-700 dark:text-red-500' }, - accent: { iconBg: 'bg-accent/15', iconColor: 'text-accent' }, -}; - -function InlineStat({ - title, - value, - icon: Icon, - variant = 'default', - onClick, -}: { - title: string; - value: number | string; - icon: LucideIcon; - variant?: StatVariant; - onClick?: () => void; -}) { - const styles = variantStyles[variant]; - - return ( - - ); -} - export function HomePage() { const { t } = useTranslation(); const navigate = useNavigate(); @@ -70,139 +40,134 @@ export function HomePage() { const { data: shared, isLoading: isSharedLoading } = useSharedSummary(); if (isOverviewLoading || isSharedLoading) { - return ( -
- {/* Hero Row Skeleton */} -
-
- -
- - -
-
-
- {[1, 2, 3, 4].map((i) => ( - - ))} -
-
- - {/* Auth Monitor Skeleton */} -
-
- - -
-
- -
- {[1, 2, 3].map((i) => ( -
- - - - -
- ))} -
-
- ); + return ; } - const healthVariant = overview?.health - ? HEALTH_VARIANTS[overview.health.status as keyof typeof HEALTH_VARIANTS] - : undefined; + const healthTone = overview?.health + ? HEALTH_TONE[overview.health.status as keyof typeof HEALTH_TONE] + : 'default'; return ( -
- {/* Hero Row: Logo/Title + Inline Stats */} -
- {/* Subtle background pattern */} -
-
-
- - {/* Single Row Layout */} -
- {/* Left: Logo + Title */} - - - {/* Right: Inline Stats */} -
- + + v{overview.version} + + ) + } + /> + + navigate('/providers')} + icon={} /> - navigate('/cliproxy')} + icon={} /> - navigate('/accounts')} + icon={} /> - navigate('/health')} + } /> -
-
-
+ + } + > + {shared?.symlinkStatus && !shared.symlinkStatus.valid && ( + + + {t('home.configurationRequired')} + {shared.symlinkStatus.message} + + )} - {/* Configuration Warning */} - {shared?.symlinkStatus && !shared.symlinkStatus.valid && ( - - - {t('home.configurationRequired')} - {shared.symlinkStatus.message} - - )} + + {/* Live account monitor — primary viz */} + + + Live account monitor + + } + > + + - {/* Auth Monitor */} - - -
-
-
-
- + {/* Logs callout */} + +
+
+
+ +
+
+

{t('homePageV2.logsMoved')}

+

+ Use the unified logs page for source-level filtering, structured entry + inspection, and retention policy edits without crowding the home dashboard. +

+
+
+
-
-

{t('homePageV2.logsMoved')}

-

- Use the unified logs page for source-level filtering, structured entry inspection, - and retention policy edits without crowding the home dashboard. -

-
-
- -
-
+ - -
+ {/* Recent errors */} + + + Recent errors + + } + > + + +
+ + + ); +} + +function HomeLoadingSkeleton() { + return ( + + } /> + + {[1, 2, 3, 4].map((i) => ( + + ))} + + } + > + + + + + + + ); }