--- import type { StatusSnapshot } from "@lib/status" interface Props { snapshot: StatusSnapshot } const { snapshot } = Astro.props // Refresh cadence for the browser. The server already caches Uptime Kuma for a // minute, so polling faster than that only adds requests without new signal. const REFRESH_MS = 60_000 function details(s: StatusSnapshot): string { const { total, up, down, pending, maintenance } = s.summary if (s.state === "unknown") { return s.reason === "stale" ? "Uptime Kuma has not reported recently" : "Status could not be read" } const parts = [`${up}/${total} monitors up`] if (down > 0) parts.push(`${down} down`) if (pending > 0) parts.push(`${pending} pending`) if (maintenance > 0) parts.push(`${maintenance} in maintenance`) if (s.incidents > 0) parts.push(`${s.incidents} incident${s.incidents === 1 ? "" : "s"}`) return parts.join(", ") } const state = snapshot.state const label = snapshot.label const detailsText = details(snapshot) --- {label}