Files
threadcount-community/app/ops/(console)/controls/page.tsx
T
ThreadCount 344b1701dd ThreadCount Community edition
Uniform stock management for healthcare linen rooms. Licensed under the GNU AGPL v3.
2026-09-13 08:54:35 +10:00

45 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { requireOperator } from "@/lib/ops/session";
import { overview } from "@/lib/ops/projections";
import { switches } from "@/lib/switches";
import Controls from "./Controls";
/* Controls: the two platform switches and the demo reset. Reads the switch row through the
* product's own reader so what is shown is exactly what the sign-up route and the demo see —
* the row, with the environment's override on top. */
export const dynamic = "force-dynamic";
export default async function OpsControls() {
const op = await requireOperator();
const [sw, o] = await Promise.all([switches(), overview()]);
const fmt = (d: Date) => d.toLocaleString("en-AU", { timeZone: "Australia/Brisbane", dateStyle: "medium", timeStyle: "short" });
return (
<>
<div className="page-head">
<div>
<div className="sec" style={{ border: 0, padding: 0 }}>Controls</div>
<h1 className="h1">Switches</h1>
<div style={{ fontSize: 13, color: "var(--color-neutral-700)", marginTop: 4 }}>
{sw.row.updatedAt ? `Last changed ${fmt(sw.row.updatedAt)}` : "Never changed from here"} · every change is written to the trail
</div>
</div>
</div>
<div className="tc-panel" style={{ marginTop: 20, maxWidth: 720 }}>
<div className="tc-panel-head"><span>Platform</span><span className="tc-panel-aside">{o.facilities} facilities · {o.live} live</span></div>
<Controls
sw={{ signupsDisabled: sw.row.signupsDisabled, demoDisabled: sw.row.demoDisabled, plansLive: sw.row.plansLive, signupsByEnv: sw.signupsByEnv, demoByEnv: sw.demoByEnv, plansByEnv: sw.plansByEnv, updatedAt: sw.row.updatedAt?.toISOString() ?? null }}
owner={op.role === "OWNER"}
demoAgoMin={o.demoRebuiltAgoMin}
/>
</div>
<div className="tc-panel" style={{ marginTop: 24, maxWidth: 720 }}>
<div className="tc-panel-head"><span>Deleting a facility</span></div>
<div className="tc-panel-body" style={{ fontSize: 13, color: "var(--color-neutral-700)" }}>
Lives on the facilitys own page, at the bottom. Owner, the facilitys exact name typed, and a live code from your second factor. It cannot be undone.
</div>
</div>
</>
);
}