import { Box, Group, Stack, Text } from "@mantine/core"; import type { ReactNode } from "react"; import type { StationWorkPhaseLog } from "@/types/trainScheduling"; import { PHASE_TONE, track, type PhaseState } from "./trackTheme"; /** Small uppercase tag — the design's one chip shape, tinted per use. */ export function Chip({ children, bg, fg, border, }: { children: ReactNode; bg: string; fg: string; border?: string; }) { return ( {children} ); } /** Card header: tinted icon chip + title + one-line hint, optional right slot. */ export function SectionHead({ icon, title, hint, right, }: { icon: ReactNode; title: string; hint: string; right?: ReactNode; }) { return ( {icon} {title} {hint} {right} ); } /** Which of the three window states a phase log is in. */ export function phaseState(log?: StationWorkPhaseLog | null): PhaseState { if (log?.endedAt) return "done"; if (log?.startedAt) return "active"; return "idle"; } export function phaseChipLabel( phase: "loading" | "unloading", state: PhaseState, ) { const title = phase === "loading" ? "Loading" : "Unloading"; const suffix = state === "done" ? "done" : state === "active" ? "in progress" : "not started"; return `${title} ${suffix}`; } export function PhaseChip({ phase, state, }: { phase: "loading" | "unloading"; state: PhaseState; }) { const tone = PHASE_TONE[state]; return ( {phaseChipLabel(phase, state)} ); }