/* ==================================================================
Overview → Dashboard
------------------------------------------------------------------
The landing screen. Three headline tiles, then enrolment by wing, the
staff check-in ring, and the school calendar.
Every figure is read from the two live databases — the Cockpit's own
Postgres and the Ledger (finance) — via /admin/cockpit/dashboard and
/admin/cockpit/finance. Where a subsystem has recorded nothing, the tile
says so rather than printing a zero that reads like a measurement.
================================================================== */
const DashScreen = ({ setScreen }) => {
const CX = window.CX;
const state = CX.useCockpitData("/admin/cockpit/dashboard", { pollMs: 120000 });
const money = CX.useCockpitData("/admin/cockpit/finance", { pollMs: 300000 });
const [monthOffset, setMonthOffset] = useState(0);
const d = state.data;
const user = window.APP.CURRENT_USER;
const school = window.APP.CURRENT_SCHOOL;
const firstName = user?.name?.split(/\s+/)[0];
const hour = new Date().getHours();
const partOfDay = hour < 12 ? "morning" : hour < 17 ? "afternoon" : "evening";
const dateLabel = new Date().toLocaleDateString("en-IN", {
weekday: "long", day: "numeric", month: "long", year: "numeric",
}).toUpperCase();
const fin = money.data;
return (