import { motion } from 'framer-motion'; import { CheckCircle2, Loader2, Image as ImageIcon, Search, Activity, Cpu, ShieldCheck, Flag } from 'lucide-react'; import { useState, useEffect } from 'react'; const WORKFLOW_STEPS = [ { label: "Image Input", icon: ImageIcon, desc: "Load & Preprocess" }, { label: "CV Extraction", icon: Search, desc: "Edge, Blur, Lighting" }, { label: "Freq Analysis", icon: Activity, desc: "FFT, Moiré, Banding" }, { label: "XGBoost", icon: Cpu, desc: "Phone-Adapted Model" }, { label: "Rule Layer", icon: ShieldCheck, desc: "Contextual Corrections" }, { label: "Final Score", icon: Flag, desc: "Risk Band Assigned" } ]; export function WorkflowAnimation({ isAnalyzing, isComplete }) { const [currentStep, setCurrentStep] = useState(-1); useEffect(() => { if (!isAnalyzing && !isComplete) { setCurrentStep(-1); return; } if (isComplete) { setCurrentStep(WORKFLOW_STEPS.length); return; } if (isAnalyzing) { setCurrentStep(0); // Honest log: wait on step 0 until backend returns } }, [isAnalyzing, isComplete]); return (
{/* Connector Line Background */}
{/* Animated Active Connector Line */} {currentStep >= 0 && ( )}
{WORKFLOW_STEPS.map((step, index) => { const isPast = currentStep > index; const isCurrent = currentStep === index; const isFuture = currentStep < index; const Icon = step.icon; return (
{isCurrent ? ( ) : isPast ? ( ) : ( )}
{step.label} {step.desc}
); })}
); }