import { CheckCircleIcon } from '@heroicons/react/24/solid'; import { MachineStatus } from '../types/machine'; interface WorkflowStepperProps { machineStatus: MachineStatus; isConnected: boolean; hasPattern: boolean; patternUploaded: boolean; } interface Step { id: number; label: string; description: string; } const steps: Step[] = [ { id: 1, label: 'Connect', description: 'Connect to machine' }, { id: 2, label: 'Load Pattern', description: 'Choose PES file' }, { id: 3, label: 'Upload', description: 'Upload to machine' }, { id: 4, label: 'Mask Trace', description: 'Trace pattern area' }, { id: 5, label: 'Start Sewing', description: 'Begin embroidery' }, { id: 6, label: 'Monitor', description: 'Watch progress' }, { id: 7, label: 'Complete', description: 'Finish and remove' }, ]; function getCurrentStep(machineStatus: MachineStatus, isConnected: boolean, hasPattern: boolean, patternUploaded: boolean): number { if (!isConnected) return 1; if (!hasPattern) return 2; if (!patternUploaded) return 3; // After upload, determine step based on machine status switch (machineStatus) { case MachineStatus.IDLE: case MachineStatus.MASK_TRACE_LOCK_WAIT: case MachineStatus.MASK_TRACING: return 4; case MachineStatus.MASK_TRACE_COMPLETE: case MachineStatus.SEWING_WAIT: return 5; case MachineStatus.SEWING: case MachineStatus.COLOR_CHANGE_WAIT: case MachineStatus.PAUSE: case MachineStatus.STOP: case MachineStatus.SEWING_INTERRUPTION: return 6; case MachineStatus.SEWING_COMPLETE: return 7; default: return 4; } } export function WorkflowStepper({ machineStatus, isConnected, hasPattern, patternUploaded }: WorkflowStepperProps) { const currentStep = getCurrentStep(machineStatus, isConnected, hasPattern, patternUploaded); return (
{/* Progress bar background */}
{/* Progress bar fill */}
{/* Steps */}
{steps.map((step) => { const isComplete = step.id < currentStep; const isCurrent = step.id === currentStep; const isUpcoming = step.id > currentStep; return (
{/* Step circle */}
{isComplete ? (
{/* Step label */}
{step.label}
); })}
); }