import { Users, Coins, TrendingUp, Gift, Loader2, AlertTriangle, CheckCircle, XCircle, Info, Clock, Wifi, Trophy, Crown, Gem, Wrench, } from "lucide-react"; import { cn } from "../lib/utils"; import { useDashboard, type DashboardStats } from "../lib/useDashboard"; function formatNumber(n: number | string): string { const num = typeof n === "string" ? parseFloat(n) : n; if (num >= 1_000_000) return `${(num / 1_000_000).toFixed(1)}M`; if (num >= 1_000) return `${(num / 1_000).toFixed(1)}K`; return num.toLocaleString(); } function formatUptime(ms: number): string { const hours = Math.floor(ms / 3_600_000); const minutes = Math.floor((ms % 3_600_000) / 60_000); if (hours >= 24) { const days = Math.floor(hours / 24); return `${days}d ${hours % 24}h`; } return `${hours}h ${minutes}m`; } function timeAgo(ts: string | Date): string { const diff = Date.now() - new Date(ts).getTime(); const mins = Math.floor(diff / 60_000); if (mins < 1) return "just now"; if (mins < 60) return `${mins}m ago`; const hours = Math.floor(mins / 60); if (hours < 24) return `${hours}h ago`; return `${Math.floor(hours / 24)}d ago`; } const eventIcons = { success: CheckCircle, error: XCircle, warn: AlertTriangle, info: Info, } as const; const eventColors = { success: "text-success", error: "text-destructive", warn: "text-warning", info: "text-info", } as const; function StatCard({ icon: Icon, label, value, sub, accent = "border-primary", }: { icon: React.ComponentType<{ className?: string }>; label: string; value: string; sub?: string; accent?: string; }) { return (
{error}