'use client'; import React, { useState, useEffect } from 'react'; import { Sparkles, Cpu, Layers, Zap, ShieldCheck } from 'lucide-react'; interface ProcessingOverlayProps { toolName?: string; stageMessages?: string[]; aspectRatio?: string; } export function ProcessingOverlay({ toolName = 'Neural Vision Model', stageMessages, aspectRatio = 'aspect-[4/3] sm:aspect-[16/10]', }: ProcessingOverlayProps) { const defaultStages = [ 'Initializing volatile GPU tensor core...', 'Analyzing photographic topology & lighting coordinates...', 'Synthesizing generative neural model...', 'Reconstructing sub-pixel micro-details & HD polish...', 'Finalizing crystal-clear preview...', ]; const stages = stageMessages && stageMessages.length > 0 ? stageMessages : defaultStages; const [currentStageIdx, setCurrentStageIdx] = useState(0); const [progress, setProgress] = useState(12); const [elapsedSec, setElapsedSec] = useState(0); // Smooth elapsed timer useEffect(() => { const timer = setInterval(() => { setElapsedSec((prev) => +(prev + 0.1).toFixed(1)); }, 100); return () => clearInterval(timer); }, []); // Cycle through inference stages & smooth progress curve useEffect(() => { const stageInterval = setInterval(() => { setCurrentStageIdx((prev) => (prev < stages.length - 1 ? prev + 1 : prev)); }, 900); const progressInterval = setInterval(() => { setProgress((prev) => { if (prev >= 94) return 94; // Wait for server resolution const delta = Math.max(1, Math.floor((95 - prev) * 0.15)); return Math.min(94, prev + delta); }); }, 150); return () => { clearInterval(stageInterval); clearInterval(progressInterval); }; }, [stages.length]); return (
{/* 1. Moving Laser Scanning Beam */}
{/* 2. Cybernetic Vision Grid Overlay */}