// src/components/AnalysisProgress.jsx import { useEffect, useState } from 'react'; const STEPS = [ { key: 'frames', label: 'Extracting Frames', desc: 'Sampling video at 1 fps for visual analysis', icon: '🎞️', weight: 20, }, { key: 'audio', label: 'Analyzing Audio', desc: 'Running MFCCs + spectral deepfake detection', icon: '🎙️', weight: 25, }, { key: 'lipsync', label: 'Lip-Sync Check', desc: 'Aligning phoneme boundaries with lip motion', icon: '👄', weight: 25, }, { key: 'fusion', label: 'Multimodal Fusion', desc: 'Combining modality scores via learned weights', icon: '⚡', weight: 20, }, { key: 'done', label: 'Generating Report', desc: 'Producing Grad-CAM heatmaps & sync profile', icon: '📊', weight: 10, }, ]; function getStepState(stepKey, currentKey) { const currentIdx = STEPS.findIndex((s) => s.key === currentKey); const stepIdx = STEPS.findIndex((s) => s.key === stepKey); if (stepIdx < currentIdx) return 'completed'; if (stepIdx === currentIdx) return 'active'; return 'waiting'; } function getProgress(currentKey) { const idx = STEPS.findIndex((s) => s.key === currentKey); if (idx < 0) return 0; const completedWeight = STEPS.slice(0, idx).reduce((sum, s) => sum + s.weight, 0); const activeWeight = STEPS[idx].weight * 0.5; // half-credit for active step return Math.round(completedWeight + activeWeight); } export default function AnalysisProgress({ currentStep, filename }) { const [displayProgress, setDisplayProgress] = useState(0); const targetProgress = currentStep === 'done' ? 100 : getProgress(currentStep); useEffect(() => { const timer = setTimeout(() => setDisplayProgress(targetProgress), 50); return () => clearTimeout(timer); }, [targetProgress]); return (
{/* Header */}

Analyzing Video

{filename && (

{filename}

)}
{/* Steps */}
    {STEPS.map((step) => { const state = getStepState(step.key, currentStep); return (
  1. {/* Step icon */} {/* Text */}
    {step.label}
    {step.desc}
    {/* Status */} {state === 'completed' && 'Done'} {state === 'active' && 'Running'} {state === 'waiting' && 'Queued'}
  2. ); })}
{/* Overall progress bar */}
Overall Progress {displayProgress}%
); }