"use client" import { SettingsSectionHeader } from "@/components/gmail/settings/settings-section-header" import { SettingsSyncBanner } from "@/components/gmail/settings/settings-sync-banner" import { AdminRuntimePanel } from "@/components/admin/settings/admin-runtime-panel" import { useAdminStats } from "@/lib/api/hooks/use-admin-queries" import { formatBytes } from "@/lib/admin/format-bytes" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" export function OverviewSection() { const { data, isFetching, isError, refetch } = useAdminStats() const storage = data?.storage return ( <> refetch()} /> {data ? (
{storage ? (
) : null}
Audit (24 h)

{data.services.audit_events_24h}

événements enregistrés

Quotas mail

{data.quotas.users_near_mail_quota_90pct}

utilisateurs à plus de 90 % du quota

{data.audit.top_actors_7d.length > 0 ? ( Top acteurs (7 j) {data.audit.top_actors_7d.map((item) => (
{item.actor} {item.count}
))}
) : null}
) : isFetching ? (

Chargement des statistiques…

) : null} ) } function StatCard({ label, value, hint, }: { label: string value: number hint?: string }) { return ( {label}

{value.toLocaleString("fr-FR")}

{hint ?

{hint}

: null}
) } function StorageCard({ label, used, allocated, tracked = true, }: { label: string used: number allocated: number tracked?: boolean }) { const pct = allocated > 0 ? Math.min(100, Math.round((used / allocated) * 100)) : 0 return ( {label}

{formatBytes(used)} {" "} / {formatBytes(allocated)}

{tracked ? `${pct} % des quotas alloués` : "Mesure non disponible"}

) }