import { useState, useEffect } from 'react'; import { ActivityIcon } from 'lucide-react'; import { useTranslation } from 'react-i18next'; export default function Intro({ onComplete }) { const { t } = useTranslation(); // We use these two states to trigger Tailwind's CSS transitions const [isVisible, setIsVisible] = useState(false); const [progress, setProgress] = useState(0); useEffect(() => { // 1. A split-second after the app loads, trigger the text to fade in setTimeout(() => setIsVisible(true), 100); // 2. Start the fake "loading bar" animation, pushing it to 100% setTimeout(() => setProgress(100), 300); // 3. After 2.5 seconds, tell App.jsx "I'm done, destroy me!" setTimeout(() => { setIsVisible(false); // Fade out setTimeout(() => onComplete(), 500); // Wait for fade-out to finish, then unmount }, 2500); }, [onComplete]); return ( // 'fixed inset-0 z-50' forces this black screen to cover everything else on the website
{t('intro.loading')}
{/* The Progress Bar Container */}