import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Activity, Server, Users, Zap } from "lucide-react"; import { useDashboardStats } from "@/hooks/use-dashboard-stats"; import { useActivityStats } from "@/hooks/use-activity-stats"; import { ControlPanel } from "@/components/ControlPanel"; import { ActivityChart } from "@/components/ActivityChart"; export function Dashboard() { const { stats, loading, error } = useDashboardStats(); const { data: activityData, loading: activityLoading } = useActivityStats(); if (loading && !stats) { return (

Dashboard

Loading dashboard data...

{[1, 2, 3, 4].map((i) => ( Loading...
))}
); } if (error) { return (

Dashboard

Error loading dashboard: {error}

); } if (!stats) { return null; } return (

{stats.bot.name} Overview

Monitoring real-time activity and core bot metrics.

{/* Metric Cards */} {[ { title: "Active Users", value: stats.users.active.toLocaleString(), label: `${stats.users.total.toLocaleString()} total registered`, icon: Users, color: "from-purple-500 to-pink-500" }, { title: "Commands registered", value: stats.commands.total, label: "Total system capabilities", icon: Zap, color: "from-yellow-500 to-orange-500" }, { title: "Avg Latency", value: `${stats.ping.avg}ms`, label: "WebSocket heartbeat", icon: Activity, color: "from-emerald-500 to-teal-500" }, ].map((metric, i) => ( {metric.title}
{metric.value}

{metric.label}

))}
{/* Activity Chart Section */}
Live Activity Analytics Hourly command and transaction volume across the network (last 24h)
Economy Overview Global wealth and progression statistics
Uptime: {Math.floor(stats.uptime / 3600)}h {Math.floor((stats.uptime % 3600) / 60)}m

Total Distributed Wealth

{BigInt(stats.economy.totalWealth).toLocaleString()} AU

Avg Level

{stats.economy.avgLevel}

Peak Streak

{stats.economy.topStreak} days

{/* Administrative Control Panel */} {/* Recent Events Feed */} Recent Events Live system activity feed
{stats.recentEvents.length === 0 ? (

No activity recorded

) : ( stats.recentEvents.slice(0, 6).map((event, i) => (
{event.icon}

{event.message}

{new Date(event.timestamp).toLocaleTimeString()}

)) )}
{stats.recentEvents.length > 0 && ( )}
); }