/* ── DeployModal — Frosted glass deploy flow ── * Step-by-step animated deployment progress */ import { useState, useEffect, useCallback } from "react"; interface DeployModalProps { open: boolean; onClose: () => void; } const STEPS = [ { label: "Validating configuration", icon: "✓" }, { label: "Building project", icon: "📦" }, { label: "Running tests", icon: "🧪" }, { label: "Deploying to production", icon: "🚀" }, { label: "Health check", icon: "💓" }, ]; export function DeployModal({ open, onClose }: DeployModalProps) { const [currentStep, setCurrentStep] = useState(-1); const [complete, setComplete] = useState(false); useEffect(() => { if (!open) { setCurrentStep(-1); setComplete(false); return; } setCurrentStep(0); }, [open]); useEffect(() => { if (currentStep < 0 || currentStep >= STEPS.length) return; const delay = 1200 + Math.random() * 800; const timer = setTimeout(() => { if (currentStep === STEPS.length - 1) { setComplete(true); } else { setCurrentStep((s) => s + 1); } }, delay); return () => clearTimeout(timer); }, [currentStep]); const handleClose = useCallback(() => { setCurrentStep(-1); setComplete(false); onClose(); }, [onClose]); if (!open) return null; return (