"use client"; /** * TASK-0133 — Overview tab: org counts + 30-day storage/audit trend + the * effective policy (the plan caps the file size; see the Policies tab to edit * it). Data: `GET /orgs/:orgId/admin/overview`. */ import { useQuery } from "@tanstack/react-query"; import { Database, FileText, NotebookText, User, Users } from "lucide-react"; import { orgAdminApi } from "@/lib/org-admin"; import { Section } from "@/components/settings/settings-shell"; function formatBytes(n: number): string { if (n < 1024) return `${n} B`; const units = ["KB", "MB", "GB", "TB"]; let v = n / 1024; let i = 0; while (v >= 1024 && i < units.length - 1) { v /= 1024; i += 1; } return `${v.toFixed(1)} ${units[i]}`; } /** A tiny inline bar sparkline (no chart library — the org console keeps its * dependencies lean). Pure CSS bars, ARIA-labelled. */ function Sparkline({ points, label, fmt }: { points: { day: string; value: number }[]; label: string; fmt: (n: number) => string }) { const max = Math.max(1, ...points.map((p) => p.value)); return (
Loading overview…
; } if (q.isError) { returnCould not load the overview.
; } const o = q.data!; return (