import { useState, useCallback, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import useChatStore from '../../store/useChatStore'; import { fetchHealth } from '../../api/client'; export default function BootScreen() { const setBooted = useChatStore(s => s.setBooted); const setHealth = useChatStore(s => s.setHealth); const [clicked, setClicked] = useState(false); const [exiting, setExiting] = useState(false); const [progress, setProgress] = useState(0); const handleLaunch = useCallback(async () => { if (clicked) return; setClicked(true); // Animate progress bar const steps = [15, 35, 60, 85, 100]; for (const p of steps) { setProgress(p); await new Promise(r => setTimeout(r, 70)); } // Health check — fire-and-forget fetchHealth() .then(h => setHealth({ status: h.status === 'healthy' ? 'healthy' : 'degraded', latency: null })) .catch(() => setHealth({ status: 'degraded', latency: null })); await new Promise(r => setTimeout(r, 150)); setExiting(true); await new Promise(r => setTimeout(r, 300)); setBooted(); }, [clicked, setBooted, setHealth]); // Auto-launch on mount useEffect(() => { const timer = setTimeout(() => { handleLaunch(); }, 100); return () => clearTimeout(timer); }, [handleLaunch]); return ( {!exiting && ( {/* Animated gradient orbs */}
{/* Subtle grid pattern */}
{/* Center card */}
{/* Logo icon */}
PlainSQL AI Data Platform v2.1 SECURE BUILD
{/* Progress and status */}
Initializing secure sandbox...
{/* Footer info */}
Automated RAG SQL Sandboxed
)} ); }