);
}
function TimelineItem({ t }) {
const d = useData();
const o = d.outcome(t.event_id);
const rows = d.byEvent[t.event_id] || [];
const ic = o === "acted" ? "wrench" : o === "esc" ? "alert" : "minus";
const color = o === "acted" ? "var(--good-text)" : o === "esc" ? "var(--warn)" : "var(--muted)";
const writes = rows.filter((r) => r.ok && WRITE_TOOLS.has(r.tool)).length;
const what = o === "acted" ? tr("{writes} changes made", { writes: writes }) : o === "esc" ? tr("Handed to a human") : tr("No action needed");
return (
{t.event_id} · {what}
{when(t.received_at)} · {kindWords(t)}
);
}
function CallsTable({ data }) {
return (
{tr("Event")}
{GROUPS.map((g) =>
{g.label}
)}
{tr("Total")}
{data.map((r) =>
{r.id}
{r.vals.map((v, i) =>
{v}
)}
{r.total}
)}
);
}
// Customer promise impact: each customer order behind a moved build, its new build date against the
// date the customer was promised. Built by the server from the action log and the company records.
const BANDS = [
["on_track", "On track", "var(--good)", "Still built at least 2 days before the promised date"],
["tight", "Tight", "var(--warn)", "Built 0 to 1 day before the promised date"],
["late", "Late", "var(--bad)", "Built after the promised date"],
];
function PromiseCard({ p }) {
const tipProps = useTipProps();
const { set } = useUi();
const total = p?.orders || 0;
return (
{p.late_priority
? tr("{n} of {m} late Platinum and Gold customers have a loaner", { n: fmt(p.late_priority_with_loaner), m: fmt(p.late_priority) })
: tr("No Platinum or Gold customer is late")}
{p.most_at_risk.length > 0 && <>
{tr("Most at risk")}
{p.most_at_risk.map((o) => (
))}
>}
>}
);
}
// The first thing a visitor sees: what this is, how well it works (from the saved test runs), and a
// button that plays the given events through the real tower, live. Online the numbers come only from
// the visitor's own test run of the demo events ("—" until they run one).
function Hero({ run }) {
const d = useData();
const { toast } = useUi();
const job = run.job;
const reader = (sid, label) => d.suiteById(sid)?.readers.find((r) => r.label === label);
const blind = reader("blind100", tr("AI model")), rules = reader("blind100", tr("Rule reader")), given = reader("given", tr("AI model"));
// Online the demo has a short set of the given events: count only their test results.
const demoCases = d.demoSize && given?.cases ? given.cases.filter((c) => d.demoIds.includes(c.id)) : null;
const tested = demoCases ? { passed: demoCases.filter((c) => c.verdict === "PASS").length, total: demoCases.length } : given;
const pct = (r) => (r && r.total ? Math.round((r.passed / r.total) * 100) : null);
const now = job?.current ? String(job.current) : "";
const runDemo = async () => { const err = await run.start(); if (err) toast(err); };
return (
{job?.running ? tr("Live · {done} of {total} events · reading {now}", { done: fmt(job.done), total: fmt(job.total), now: now || "…" })
: tr("Operations control tower · Hitachi Hack the Highway")}
{tr("Wacky Wheels Control Tower")}
{tr("An AI model reads every supplier, plant and dealer message. Code checks each reading against the company records, then agents reschedule production, notify dealers and assign loaners. Anything unclear goes to a person.")}
{tr("Open the Event Center")}{d.demoSize ? tr("Plays {n} of the given events through the tower, live, one of each kind.", { n: fmt(d.demoSize) }) : tr("Plays the 15 given events through the tower, live.")}