import { Check, Truck, ClipboardList, Search, Clock, ThumbsUp, Wrench, Package, HandMetal, Ban } from 'lucide-react' const STEPS = [ { key: 'in_transit', label: 'In Transit', icon: Truck }, { key: 'intake', label: 'Intake', icon: ClipboardList }, { key: 'diagnosing', label: 'Diagnosing', icon: Search }, { key: 'pending_approval', label: 'Pending Approval', icon: Clock }, { key: 'approved', label: 'Approved', icon: ThumbsUp }, { key: 'in_progress', label: 'In Progress', icon: Wrench }, { key: 'ready', label: 'Ready', icon: Package }, { key: 'picked_up', label: 'Picked Up', icon: HandMetal }, ] as const const BRANCH_STATUSES: Record = { pending_parts: { label: 'Pending Parts', parentStep: 'in_progress' }, delivered: { label: 'Delivered', parentStep: 'picked_up' }, } interface StatusProgressProps { currentStatus: string onStatusClick?: (status: string) => void } export function StatusProgress({ currentStatus, onStatusClick }: StatusProgressProps) { const isCancelled = currentStatus === 'cancelled' const isBranch = currentStatus in BRANCH_STATUSES // Find the effective step index for branch statuses const effectiveStatus = isBranch ? BRANCH_STATUSES[currentStatus].parentStep : currentStatus const currentIdx = STEPS.findIndex((s) => s.key === effectiveStatus) return (
{STEPS.map((step, idx) => { const isCompleted = !isCancelled && currentIdx > idx const isCurrent = !isCancelled && currentIdx === idx const isFuture = isCancelled || currentIdx < idx return (
{/* Step circle */} {/* Connector line */} {idx < STEPS.length - 1 && (
idx ? 'bg-primary' : 'bg-muted-foreground/20'} ${isCancelled ? 'bg-destructive/20' : ''} `} /> )}
) })}
{/* Branch status indicator */} {isBranch && (
{BRANCH_STATUSES[currentStatus].label}
)} {/* Cancelled overlay */} {isCancelled && (
Cancelled
)}
) }