import { useEffect, useState } from 'react'; import { useLocation } from 'react-router-dom'; import { motion, AnimatePresence } from 'framer-motion'; export function NavigationProgress() { const location = useLocation(); const [isNavigating, setIsNavigating] = useState(false); const [progress, setProgress] = useState(0); useEffect(() => { setIsNavigating(true); setProgress(0); // Simulate progress const timer1 = setTimeout(() => setProgress(30), 50); const timer2 = setTimeout(() => setProgress(60), 150); const timer3 = setTimeout(() => setProgress(80), 300); const timer4 = setTimeout(() => { setProgress(100); setTimeout(() => setIsNavigating(false), 200); }, 500); return () => { clearTimeout(timer1); clearTimeout(timer2); clearTimeout(timer3); clearTimeout(timer4); }; }, [location.pathname]); return ( {isNavigating && ( )} ); }