import { requireOperator } from "@/lib/ops/session"; import { overview } from "@/lib/ops/projections"; import { version } from "@/lib/ops/version"; /* Overview: is everything up, how many facilities, who needs attention. Counts and dates only — * nothing on this screen names a person or reads a record. */ export const dynamic = "force-dynamic"; const tile: React.CSSProperties = { background: "var(--color-bg)", padding: 16 }; const figure: React.CSSProperties = { fontSize: 30, fontWeight: 800, lineHeight: 1, fontVariantNumeric: "tabular-nums" }; const label: React.CSSProperties = { fontSize: 11, fontWeight: 700, letterSpacing: "0.09em", textTransform: "uppercase", color: "var(--color-neutral-600)", marginTop: 6 }; const note: React.CSSProperties = { fontSize: 12, color: "var(--color-neutral-700)", marginTop: 2 }; export default async function OpsOverview() { await requireOperator(); const o = await overview(); const v = version(); const stale = !!(v.deployed && v.running && v.deployed.sha !== v.running); const fmtAt = (d: Date) => d.toLocaleString("en-AU", { timeZone: "Australia/Brisbane", dateStyle: "medium", timeStyle: "short" }); const attention = [ ...o.overdueBackups.map((f) => ({ tone: "warn", who: f.name, what: f.backupAgeDays === null ? "has never exported a backup" : `has not exported a backup in ${f.backupAgeDays} days`, meta: `${f.issues.toLocaleString()} issues on record`, href: `/ops/facilities/${f.id}` })), ...o.neverIssued.map((f) => ({ tone: "dormant", who: f.name, what: "has never issued", meta: `signed up ${f.createdAt.toLocaleDateString("en-AU", { day: "numeric", month: "short" })} · ${f.staff} staff · ${f.items} items`, href: `/ops/facilities/${f.id}` })), ...o.unconfiguredList.map((f) => ({ tone: "dormant", who: f.name, what: "has no staff groups named", meta: "everyone is on manager approval until a group goes on a route", href: `/ops/facilities/${f.id}` })), ]; const drift = o.migrations.applied !== o.migrations.inRepo; return ( <>