mirror of
https://github.com/nicetry247/offlineacademy.git
synced 2026-07-26 11:58:44 +00:00
27 lines
790 B
TypeScript
Executable File
27 lines
790 B
TypeScript
Executable File
'use client'
|
|
|
|
import * as React from 'react'
|
|
import { ThemeProvider } from '@/components/ThemeToggle'
|
|
import { ToastProvider } from '@/hooks/use-toast'
|
|
import { SplashScreen } from '@/components/SplashScreen'
|
|
|
|
export function Providers({ children }: { children: React.ReactNode }) {
|
|
const [showSplash, setShowSplash] = React.useState(true)
|
|
|
|
// Safety fallback: force hide after 5 seconds max
|
|
React.useEffect(() => {
|
|
const timer = setTimeout(() => setShowSplash(false), 5000)
|
|
return () => clearTimeout(timer)
|
|
}, [])
|
|
|
|
return (
|
|
<ThemeProvider>
|
|
<ToastProvider>
|
|
{showSplash && (
|
|
<SplashScreen onComplete={() => setShowSplash(false)} minDuration={1500} />
|
|
)}
|
|
{!showSplash && children}
|
|
</ToastProvider>
|
|
</ThemeProvider>
|
|
)
|
|
} |