import { useState, useEffect } from 'react'; import { useQuery } from '@tanstack/react-query'; import { motion } from 'framer-motion'; import { Activity, TrendingUp, ArrowUp } from 'lucide-react'; function Skeleton({ className = "", animate = true }: { className?: string; animate?: boolean }) { return
; } function useLayout() { return {}; } export function MetricsDashboardApp() { const layout = useLayout(); const { data: metrics, isLoading } = useQuery({ queryKey: ['os-dashboard-metrics'], queryFn: async () => { const res = await fetch('/api/metrics'); return res.json(); }, refetchInterval: 30000, }); const [animatedValues, setAnimatedValues] = useState({ profiles: 0, projects: 0, xp: 0 }); useEffect(() => { if (metrics) { const duration = 1000; const steps = 20; const interval = duration / steps; let step = 0; const timer = setInterval(() => { step++; const progress = step / steps; setAnimatedValues({ profiles: Math.round(progress * (metrics.totalProfiles || 0)), projects: Math.round(progress * (metrics.totalProjects || 0)), xp: Math.round(progress * (metrics.totalXP || 0)), }); if (step >= steps) clearInterval(timer); }, interval); return () => clearInterval(timer); } }, [metrics]); if (isLoading) { return (
); } return (

Live Metrics

Architects
{animatedValues.profiles}
+{Math.floor(Math.random() * 5) + 1} today
Projects
{animatedValues.projects}
Active
Total XP
{animatedValues.xp.toLocaleString()}
Online
{metrics?.onlineUsers || 0}
Live
Network Activity
{Array.from({ length: 20 }).map((_, i) => { const height = Math.random() * 80 + 20; return ( ); })}
); }