/** * The Article 14 reporting clock: a horizontal track from the moment you become * aware, with ticks at 24 hours, 72 hours and the final report. The first two * are drawn to scale; the final report hangs off a dashed segment because its * deadline depends on when a fix is available (or, for a severe incident, on * when the notification was sent). */ import { useEffect, useState } from 'react'; export type StageState = 'done' | 'overdue' | 'soon' | 'pending' | 'static'; export interface ClockStage { name: string; /** Shown in mono above the name: an absolute time, or "+24 hours". */ when: string; state: StageState; /** Short status line under the name. */ status?: string; } /** Tick positions (%). 24 h and 72 h are to scale; the final report sits at the end. */ const POSITIONS = [22, 62, 100]; export function ReportingClock({ start, stages, startWhen, startName = 'Aware', label }: { /** ISO time the manufacturer became aware. Omit for the static explainer. */ start?: string | null; stages: [ClockStage, ClockStage, ClockStage]; startWhen: string; startName?: string; /** Accessible name for the group. */ label?: string; }) { const now = useNow(start ? 60_000 : null); const elapsed = start ? elapsedPosition(start, now, stages) : null; return (