Build ErsatzTV Image / Docs update reminder (push) Has been skipped
Build ErsatzTV Image / decisions.md append-only (push) Has been skipped
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Has been skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Has been skipped
Build ErsatzTV Image / Functional E2E (curl contracts) (push) Successful in 4m46s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 11m26s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 13m34s
Build ErsatzTV Image / Build & push image (amd64) (push) Failing after 16s
Bulk mirror sweep (#388): author/rebuild a prototype mockup for every shipped SPA screen so the Claude Design project (eb3b6122 / local design-system/) faithfully reflects prod. - 40 screens authored (mockups: visual/layout parity, no logic) via a fan-out workflow; 8 stale prototypes rebuilt (Dashboard, ChannelBuilder, Guide, Schedules, Playouts, Settings, …), 32 net-new (media/sources/system/auth). Retired Epg/ScheduleEditor/ScheduleLibrary. - New screens.js = single source of truth for the inventory; Shell.jsx nav + app.html screen map both build from it (nav groups mirror web/src/app/routes.tsx). app.html is now hash-routed. - All 42 views verified rendering headlessly across the 3 themes (126/126, 0 real errors). - design-sync-reminder.sh hook (+ settings.json): mechanical, fail-open, once/session nudge to pull-first (PreToolUse Write|Edit on web/src/**.{tsx,css}) and mirror/push-back (Stop) — keeps the design system from drifting from prod going forward. - docs/design-sync.md: document the bulk-sweep structure + the reminder hook. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
182 lines
11 KiB
React
182 lines
11 KiB
React
// Guide screen — a horizontally-scrolling EPG grid: sticky channel rail down
|
|
// the left, a 30-min time ruler across the top, a live "now" marker, and
|
|
// programme blocks (current-programme highlight, filler dimming, empty rows).
|
|
(function () {
|
|
const NS = window.ChicoryTVDesignSystem_eb3b61;
|
|
const { Badge, Button, ChannelLogo, Select, StatusDot } = NS;
|
|
const Ico = window.Ico;
|
|
const mono = { fontFamily: "var(--font-mono)", fontVariantNumeric: "tabular-nums" };
|
|
|
|
const SLOT_MIN = 30;
|
|
const SLOT_W = 156;
|
|
const RAIL_W = 196;
|
|
const ROW_H = 82;
|
|
const HEAD_H = 34;
|
|
const WINDOW_HOURS = 13;
|
|
const SLOT_COUNT = (WINDOW_HOURS * 60) / SLOT_MIN;
|
|
|
|
const WINDOW_START = new Date(2026, 0, 1, 12, 0, 0);
|
|
const WINDOW_END = new Date(WINDOW_START.getTime() + WINDOW_HOURS * 60 * 60000);
|
|
const NOW = new Date(WINDOW_START.getTime() + 312 * 60000); // 5:12 PM — mid-window
|
|
const nowInWindow = NOW >= WINDOW_START && NOW <= WINDOW_END;
|
|
const nowMin = (NOW.getTime() - WINDOW_START.getTime()) / 60000;
|
|
|
|
function formatTime(d) { return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); }
|
|
function pxFromMin(min) { return (min / SLOT_MIN) * SLOT_W; }
|
|
|
|
const slots = Array.from({ length: SLOT_COUNT }, (_, i) => new Date(WINDOW_START.getTime() + i * SLOT_MIN * 60000));
|
|
const nowOffset = pxFromMin(nowMin);
|
|
const totalWidth = RAIL_W + slots.length * SLOT_W;
|
|
const windowPct = nowInWindow ? Math.round((NOW.getTime() - WINDOW_START.getTime()) / (WINDOW_END.getTime() - WINDOW_START.getTime()) * 100) : 0;
|
|
|
|
function buildProgrammes(segments) {
|
|
let t = 0;
|
|
return segments.map((seg) => {
|
|
const startMin = t;
|
|
t += seg.dur;
|
|
return { title: seg.title, subTitle: seg.sub || null, category: seg.cat || null, filler: !!seg.filler, startMin, stopMin: t };
|
|
});
|
|
}
|
|
|
|
const NEWS_TITLES = ["Midday Report", "World Markets", "Capitol Watch", "Global Desk", "Primetime Analysis", "Evening Edition", "Nightly Wrap", "Overnight Desk", "World Tonight", "Morning Preview", "Early Edition", "Business Brief", "Weather & Traffic"];
|
|
|
|
const CHANNELS = [
|
|
{
|
|
number: "1.1", name: "ChicoryTV Family", onAir: true,
|
|
programmes: buildProgrammes([
|
|
{ dur: 90, title: "Tom & Jerry — Marathon", cat: "Kids" },
|
|
{ dur: 60, title: "Bluey — Season 3", cat: "Kids", sub: "The Sleepover" },
|
|
{ dur: 120, title: "Afternoon Movie: Starlight Express", cat: "Movie" },
|
|
{ dur: 90, title: "World Tonight — Evening Bulletin", cat: "News", sub: "Live from the newsroom" },
|
|
{ dur: 120, title: "Prime Time Drama Block", cat: "Drama" },
|
|
{ dur: 90, title: "Late Night Talk", cat: "Talk" },
|
|
]),
|
|
},
|
|
{
|
|
number: "2.1", name: "World News Network", onAir: true,
|
|
programmes: buildProgrammes(NEWS_TITLES.map((t) => ({ dur: 60, title: t, cat: "News" }))),
|
|
},
|
|
{
|
|
number: "3.1", name: "Sitcom Vault", onAir: false,
|
|
programmes: buildProgrammes([
|
|
{ dur: 30, title: "The Office — Casino Night", cat: "Sitcom" },
|
|
{ dur: 30, title: "Parks & Rec — Flu Season", cat: "Sitcom" },
|
|
{ dur: 30, title: "Community — Modern Warfare", cat: "Sitcom" },
|
|
{ dur: 30, title: "Brooklyn 99 — Halloween", cat: "Sitcom" },
|
|
{ dur: 30, title: "The Office — Diversity Day", cat: "Sitcom" },
|
|
{ dur: 30, title: "Parks & Rec — The Set Up", cat: "Sitcom" },
|
|
]),
|
|
},
|
|
{
|
|
number: "4.2", name: "Synthpop Radio", onAir: true,
|
|
programmes: buildProgrammes([
|
|
{ dur: 180, title: "Retro Hits Mix", cat: "Music", filler: true },
|
|
{ dur: 180, title: "Live DJ Set — Nova", cat: "Music", sub: "Synthwave hour" },
|
|
{ dur: 180, title: "Overnight Mix", cat: "Music", filler: true },
|
|
]),
|
|
},
|
|
{
|
|
number: "5.1", name: "Kids Zone", onAir: false,
|
|
programmes: buildProgrammes([
|
|
{ dur: 60, title: "Sesame Street — Episode 4102", cat: "Kids" },
|
|
{ dur: 30, title: "Bluey — Marathon", cat: "Kids", sub: "Back-to-back episodes" },
|
|
{ dur: 90, title: "Afternoon Cartoons", cat: "Kids" },
|
|
]),
|
|
},
|
|
{ number: "9.1", name: "Retro Cartoons", onAir: false, programmes: [] },
|
|
];
|
|
|
|
function ProgrammeBlock({ p, live }) {
|
|
const left = pxFromMin(p.startMin) + 3;
|
|
const width = Math.max(24, pxFromMin(p.stopMin) - pxFromMin(p.startMin) - 6);
|
|
return (
|
|
<div title={p.subTitle ? `${p.title} - ${p.subTitle}` : p.title}
|
|
style={{
|
|
position: "absolute", left, width, top: 5, bottom: 5,
|
|
display: "flex", flexDirection: "column", gap: 3, minWidth: 0, overflow: "hidden",
|
|
border: `1px solid ${live ? "var(--status-live)" : "var(--border-hairline)"}`,
|
|
borderRadius: "var(--radius-sm)",
|
|
background: live ? "var(--ctv-live-soft)" : p.filler ? "var(--ctv-bg-sunken)" : "var(--surface-raised)",
|
|
padding: "var(--space-4) var(--space-5)",
|
|
}}>
|
|
<div style={{ display: "flex", alignItems: "center", gap: "var(--space-3)", minWidth: 0 }}>
|
|
{live && <StatusDot status="live" size={6} />}
|
|
<strong style={{ minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", font: "var(--weight-medium) var(--text-xs)/1 var(--font-sans)", color: p.filler ? "var(--text-disabled)" : "var(--text-primary)" }}>{p.title}</strong>
|
|
</div>
|
|
{p.subTitle && <span style={{ minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", font: "var(--text-2xs)/1.2 var(--font-sans)", color: "var(--text-secondary)" }}>{p.subTitle}</span>}
|
|
{p.filler ? (
|
|
<Badge tone="neutral">Filler</Badge>
|
|
) : p.category && (
|
|
<small style={{ marginTop: "auto", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", font: "var(--weight-medium) 9px/1 var(--font-sans)", letterSpacing: "0.06em", textTransform: "uppercase", color: live ? "var(--status-live)" : "var(--text-disabled)" }}>{p.category}</small>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function GuideRow({ channel, index }) {
|
|
return (
|
|
<div style={{ display: "flex", height: ROW_H, borderBottom: "1px solid var(--border-hairline)" }}>
|
|
<div style={{ width: RAIL_W, flex: "0 0 auto", position: "sticky", left: 0, zIndex: 3, display: "flex", alignItems: "center", gap: "var(--space-5)", padding: "0 var(--space-6)", background: "var(--surface-card)", borderRight: "1px solid var(--border-hairline)" }}>
|
|
<code style={{ ...mono, width: 30, flex: "0 0 auto", color: "var(--status-live)", font: "var(--weight-medium) var(--text-xs)/1 var(--font-mono)" }}>{channel.number}</code>
|
|
<ChannelLogo name={channel.name} size={30} />
|
|
<span style={{ minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", font: "var(--weight-medium) var(--text-sm)/1 var(--font-sans)", color: "var(--text-primary)" }}>{channel.name}</span>
|
|
{channel.onAir && <StatusDot status="live" size={7} />}
|
|
</div>
|
|
<div style={{ position: "relative", flex: 1, minWidth: 0, background: index % 2 ? "color-mix(in srgb, var(--surface-raised) 18%, transparent)" : "transparent" }}>
|
|
{channel.programmes.length === 0 ? (
|
|
<span style={{ position: "absolute", top: "50%", left: "var(--space-6)", transform: "translateY(-50%)", font: "var(--text-xs)/1 var(--font-sans)", color: "var(--text-disabled)" }}>No programmes in this window</span>
|
|
) : channel.programmes.map((p, i) => (
|
|
<ProgrammeBlock key={i} p={p} live={channel.onAir && nowInWindow && nowMin >= p.startMin && nowMin < p.stopMin} />
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function Guide() {
|
|
return (
|
|
<div style={{ display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", gap: "var(--space-6)", height: "100%", minHeight: 0, padding: "var(--space-6) 20px" }}>
|
|
{/* toolbar */}
|
|
<section style={{ display: "flex", alignItems: "center", flexWrap: "wrap", gap: "var(--space-5)", padding: "var(--space-5) 0", borderBottom: "1px solid var(--border-hairline)" }} aria-label="Guide controls">
|
|
<div style={{ width: 190, flex: "0 1 190px" }}>
|
|
<Select disabled label="Channel group" options={["All channels"]} size="sm" value="All channels" />
|
|
</div>
|
|
<div style={{ minWidth: 0, maxWidth: 420, flex: "1 1 240px", display: "flex", alignItems: "center", gap: "var(--space-4)" }}>
|
|
<span style={{ ...mono, color: "var(--text-disabled)", fontSize: "var(--text-2xs)" }}>{formatTime(WINDOW_START)}</span>
|
|
<input aria-label="Guide window position" disabled max="100" min="0" type="range" value={windowPct} readOnly style={{ minWidth: 0, flex: 1, accentColor: "var(--action-primary)" }} />
|
|
<span style={{ ...mono, color: "var(--text-disabled)", fontSize: "var(--text-2xs)" }}>{formatTime(WINDOW_END)}</span>
|
|
</div>
|
|
<Badge tone={nowInWindow ? "accent" : "neutral"} dot={nowInWindow}>Now {formatTime(NOW)}</Badge>
|
|
<Button variant="secondary">Previous</Button>
|
|
<Button variant="secondary">Next guide window</Button>
|
|
<Button variant="primary" startIcon={<Ico n="Crosshair" s={15} />}>Jump to now</Button>
|
|
</section>
|
|
|
|
{/* grid */}
|
|
<section style={{ minHeight: 420, overflow: "hidden", border: "1px solid var(--border-hairline)", borderRadius: "var(--radius-sm)", background: "var(--surface-app)" }} aria-label="Guide timeline">
|
|
<div style={{ width: "100%", height: "100%", overflow: "auto" }}>
|
|
<div style={{ position: "relative", width: totalWidth, minWidth: "100%" }}>
|
|
<div style={{ position: "sticky", top: 0, zIndex: 4, display: "flex", height: HEAD_H, background: "var(--surface-app)", borderBottom: "1px solid var(--border-hairline)" }}>
|
|
<div style={{ width: RAIL_W, flex: "0 0 auto", position: "sticky", left: 0, zIndex: 5, background: "var(--surface-app)", borderRight: "1px solid var(--border-hairline)" }} />
|
|
{slots.map((slot, i) => (
|
|
<div key={i} style={{ width: SLOT_W, flex: "0 0 auto", display: "flex", alignItems: "center", padding: "0 var(--space-5)", borderRight: "1px solid var(--border-hairline)", ...mono, color: "var(--text-secondary)", fontSize: "var(--text-xs)" }}>{formatTime(slot)}</div>
|
|
))}
|
|
</div>
|
|
|
|
{nowInWindow && (
|
|
<div aria-hidden="true" style={{ position: "absolute", top: HEAD_H, bottom: 0, left: RAIL_W + nowOffset, width: 2, background: "var(--status-live)", zIndex: 2, pointerEvents: "none" }}>
|
|
<span style={{ position: "absolute", top: -5, left: -4, width: 10, height: 10, borderRadius: "var(--radius-pill)", background: "var(--status-live)", boxShadow: "0 0 8px var(--status-live)" }} />
|
|
</div>
|
|
)}
|
|
|
|
{CHANNELS.map((channel, i) => <GuideRow channel={channel} index={i} key={channel.number} />)}
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
window.CTVGuide = Guide;
|
|
})();
|