/* global window, React */
// ============================================================
// Today — situational snapshot across all DCs the TP covers.
// This is the morning-ritual tab: less interactive than Tactical,
// more readout. Sections:
// 1. Hero header (date / time / one-liner)
// 2. Day KPI strip (6 KPIs)
// 3. Per-DC pulse cards (1 per DC in scope)
// 4. Two-col row: Wave health timeline + Today vs Yesterday variance
// 5. On the clock — trips delivering in the next 8h
// 6. Live agent decision stream
// ============================================================
const { useState: useTodayState, useMemo: useTodayMemo } = React;
function TodayKpi({ label, value, sub, kind }) {
return (
{label}
{value}
{sub &&
{sub}
}
);
}
// Tiny sparkline used in DC pulse cards
function Sparkline({ values, width = 100, height = 24, color = 'var(--ink-2)' }) {
if (!values || values.length === 0) return null;
const min = Math.min(...values);
const max = Math.max(...values);
const range = max - min || 1;
const pad = 2;
const dx = (width - pad * 2) / (values.length - 1);
const pts = values.map((v, i) => {
const x = pad + i * dx;
const y = pad + (1 - (v - min) / range) * (height - pad * 2);
return [x, y];
});
const d = pts.map(([x, y], i) => (i === 0 ? `M ${x} ${y}` : `L ${x} ${y}`)).join(' ');
const last = pts[pts.length - 1];
return (
);
}
// ---------- Per-DC pulse card ----------
function DcPulseCard({ dc, onOpenDc }) {
const tierColor = dc.pulseTier === 'green' ? 'var(--green)' : dc.pulseTier === 'amber' ? 'var(--amber)' : 'var(--red)';
return (