import { Plus, GripVertical, Trash2, ChevronDown, CheckCircle2, AlertTriangle, Info, Zap, Shield, SeparatorHorizontal } from 'lucide-react' import type { StepContentType } from '@/types' import { StepEditor } from './StepEditor' import { useProceduralEditorStore } from '@/store/proceduralEditorStore' import { cn } from '@/lib/utils' const contentTypeConfig: Record = { action: { icon: Zap, color: 'text-blue-400', label: 'Action' }, informational: { icon: Info, color: 'text-white/50', label: 'Info' }, verification: { icon: CheckCircle2, color: 'text-emerald-400', label: 'Verify' }, warning: { icon: AlertTriangle, color: 'text-yellow-400', label: 'Warning' }, } export function StepList() { const { steps, intakeForm, expandedStepId, setExpandedStepId, addStep, addSectionHeader, removeStep, updateStep, } = useProceduralEditorStore() const procedureSteps = steps.filter((s) => s.type === 'procedure_step') let stepCounter = 0 return (

Steps

({procedureSteps.length} step{procedureSteps.length !== 1 ? 's' : ''})
{steps.map((step) => { if (step.type === 'procedure_end') { return (
updateStep(step.id, { title: e.target.value })} className="flex-1 bg-transparent text-sm text-white/50 focus:outline-none" placeholder="Procedure Complete" /> END
) } // Section header rendering if (step.type === 'section_header') { const isExpanded = expandedStepId === step.id if (isExpanded) { return (
updateStep(step.id, updates)} onCollapse={() => setExpandedStepId(null)} availableVariables={intakeForm} />
) } return (
setExpandedStepId(step.id)} > {step.title || 'Untitled Section'}
) } // Regular procedure step stepCounter++ const stepNumber = stepCounter const isExpanded = expandedStepId === step.id const contentType = step.content_type || 'action' const config = contentTypeConfig[contentType] const Icon = config.icon if (isExpanded) { return (
updateStep(step.id, updates)} onCollapse={() => setExpandedStepId(null)} availableVariables={intakeForm} />
) } return (
{stepNumber} setExpandedStepId(step.id)} > {step.title || 'Untitled step'} {step.estimated_minutes && ( ~{step.estimated_minutes}m )}
) })}
{/* Add step button at bottom */}
) }