import type { ReactNode } from "react"; import { Badge, Box, Collapse, Group, Stack, Text, UnstyledButton } from "@mantine/core"; import type { LucideIcon } from "lucide-react"; import { Check, ChevronDown, Lock } from "lucide-react"; import { freightBrand } from "@/theme/freight-brand"; export type WorkflowStepState = "complete" | "active" | "upcoming"; /** * A single collapsible step in the scheduling workflow. Steps are stacked * inside which paints the continuous connector behind the * status circles. */ export function WorkflowStep({ index, icon: Icon, title, subtitle, state, open, onToggle, rightSlot, locked = false, children, }: { index: number; icon: LucideIcon; title: string; subtitle?: string; state: WorkflowStepState; open: boolean; onToggle: () => void; rightSlot?: ReactNode; locked?: boolean; children: ReactNode; }) { const isComplete = state === "complete"; const isActive = state === "active"; const circle = (() => { if (isComplete) { return { bg: freightBrand.primary, color: "white", border: freightBrand.primary, shadow: `0 4px 10px ${freightBrand.ring}`, }; } if (isActive) { return { bg: "white", color: freightBrand.primary, border: freightBrand.primary, shadow: `0 0 0 4px ${freightBrand.ring}`, }; } return { bg: "var(--mantine-color-gray-1)", color: "var(--mantine-color-gray-5)", border: "var(--mantine-color-gray-3)", shadow: "none", }; })(); return ( {/* Status circle (sits above the rail) */} {isComplete ? : } {/* Step card */} STEP {index + 1} {isComplete ? ( Done ) : null} {title} {subtitle ? ( {subtitle} ) : null} {rightSlot} {locked ? ( ) : ( )} {children} ); } /** * Wraps a list of and paints the continuous vertical rail that * connects the status circles. */ export function WorkflowRail({ children }: { children: ReactNode }) { return ( {/* connector rail behind the circles (circle is 40px → center at 20) */} {children} ); }