'use client' import { Activity, Users, ShieldCheck } from 'lucide-react' import { useApiFetch } from '@saaslib/nextjs' import { Card, CardContent } from './ui/card' import { Badge } from './ui/badge' type AdminUserListResponse = { items: Array<{ id: string; email: string }> total: number } const stats = [ { key: 'users', label: 'Total users', icon: Users, }, { key: 'health', label: 'API status', icon: Activity, }, { key: 'guard', label: 'Security posture', icon: ShieldCheck, }, ] export default function DashboardStats() { const { data, loading, error } = useApiFetch('/admin/users?limit=1') return (

{stats[0].label}

{loading ? '…' : data?.total ?? 0}

{stats[1].label}

{loading ? '…' : error ? 'Degraded' : 'Healthy'}

{stats[2].label}

Admin-only routes

Guarded
) }