import { useEffect, useState } from 'react' import { api } from '../../api/client' export default function DashboardPage() { const [data, setData] = useState(null) useEffect(() => { api.admin.dashboard().then(r => setData(r.dashboard)).catch(() => {}) }, []) const services = data?.services || {} const serviceCount = Object.values(services).filter(Boolean).length const totalServices = Object.keys(services).length || 3 return (

仪表盘

{/* Stats */}
{/* Service Status */}
{['ai_core', 'memory', 'voice'].map(name => (
{name}
{services[name] ? '运行中' : '未启动'}
))}
{/* Quick Links */}
) } function StatCard({ label, value, sub, color }: { label:string; value:string; sub:string; color:string }) { return (

{label}

{value}

{sub &&

{sub}

}
) } function Section({ title, children }: { title:string; children:React.ReactNode }) { return (

{title}

{children}
) } import { Link } from 'react-router-dom' function QuickLink({ to, label, desc }: { to:string; label:string; desc:string }) { return (

{label}

{desc}

) } function formatUptime(s: number) { if (s < 60) return `${s}s` if (s < 3600) return `${Math.floor(s/60)}m` return `${Math.floor(s/3600)}h${Math.floor((s%3600)/60)}m` }