import { useQuery } from "@tanstack/react-query"; import { Card, CardContent } from "@/components/ui/card"; import { TrendingUp, TrendingDown } from "lucide-react"; import { useBlockchain } from "@/hooks/useBlockchain"; export function SystemStats() { const { stats } = useBlockchain(); const { data: systemStats } = useQuery({ queryKey: ['/api/stats'], refetchInterval: 5000, // Refresh every 5 seconds }); const statCards = [ { title: "Total Blocks", value: stats?.totalBlocks?.toLocaleString() || "0", change: "+12.5%", trend: "up", icon: "🧱", color: "text-chitty-blue", }, { title: "Evidence Records", value: systemStats?.blockchain?.evidenceRecords?.toLocaleString() || "0", change: "+8.2%", trend: "up", icon: "🛡️", color: "text-green-400", }, { title: "Active Cases", value: systemStats?.cases?.activeCases?.toLocaleString() || "0", change: "+3", trend: "up", icon: "⚖️", color: "text-yellow-400", }, { title: "Property NFTs", value: systemStats?.properties?.totalProperties?.toLocaleString() || "0", change: "+15", trend: "up", icon: "🏠", color: "text-purple-400", }, ]; return (
{statCards.map((stat, index) => (

{stat.title}

{stat.value}

{stat.icon}
{stat.trend === "up" ? ( ) : ( )} {stat.change} {index === 0 && "from yesterday"} {index === 1 && "this week"} {index === 2 && "new today"} {index === 3 && "minted today"}
))}
); }