diff --git a/components/SplashScreen.tsx b/components/SplashScreen.tsx index c9ed048..08d2364 100644 --- a/components/SplashScreen.tsx +++ b/components/SplashScreen.tsx @@ -7,88 +7,57 @@ interface SplashScreenProps { minDuration?: number } -export function SplashScreen({ onComplete, minDuration = 1500 }: SplashScreenProps) { - const [visible, setVisible] = React.useState(true) - const [logoScale, setLogoScale] = React.useState(0.8) - const [textOpacity, setTextOpacity] = React.useState(0) +export function SplashScreen({ onComplete, minDuration = 550 }: SplashScreenProps) { + const [exiting, setExiting] = React.useState(false) const onCompleteRef = React.useRef(onComplete) onCompleteRef.current = onComplete React.useEffect(() => { - let mounted = true + const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches + const holdDuration = reduceMotion ? 100 : minDuration + const exitDuration = reduceMotion ? 0 : 280 - // Animation sequence - const timer = setTimeout(() => { - if (!mounted) return - setLogoScale(1) - setTextOpacity(1) - - setTimeout(() => { - if (!mounted) return - setVisible(false) - onCompleteRef.current() - }, 800) - }, minDuration) + const exitTimer = window.setTimeout(() => setExiting(true), holdDuration) + const completeTimer = window.setTimeout( + () => onCompleteRef.current(), + holdDuration + exitDuration + ) return () => { - mounted = false - clearTimeout(timer) + window.clearTimeout(exitTimer) + window.clearTimeout(completeTimer) } }, [minDuration]) - if (!visible) return null - return (
-
- {/* Animated logo - using favicon.ico */} -
+
+
+
OfflineAcademy
- - {/* App name */} -
-

+
+

OfflineAcademy

-

Your Personal Offline Learning Center

+

+ Your private learning library +

- - {/* Loading indicator */} -
-
+