"use client"; import { AlertCircle, Clock, Hash, Shield, Sparkles, Users, } from "lucide-react"; import { ErrorState, LoadingSkeleton, StatCard } from "@/components/shared"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Progress } from "@/components/ui/progress"; import { useStats } from "@/hooks"; import { formatNumber } from "@/lib/format"; export function StatsSection() { const { data: stats, isLoading, error, refetch } = useStats(); if (error) return ; if (isLoading || !stats) return (
); return (
Top Channels {stats.top_channels.length === 0 ? (

No channel data yet.

) : (
{stats.top_channels.map((ch) => { const max = stats.top_channels[0].message_count; const pct = max > 0 ? (ch.message_count / max) * 100 : 0; return (
#{ch.channel_name ?? ch.channel_id.slice(0, 8)} {formatNumber(ch.message_count)}
); })}
)}
Moderation Queue
{[ { label: "Pending", value: stats.moderation_overview.pending, cls: "bg-muted/50", }, { label: "Processing", value: stats.moderation_overview.processing, cls: "bg-yellow-500/10 text-yellow-500", }, { label: "Errors", value: stats.moderation_overview.error, cls: "bg-destructive/10 text-destructive", }, ].map(({ label, value, cls }) => (
{value}
{label}
))}
); }