'use client'; import { createContext, useContext, useEffect, useState, ReactNode } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { WEB_VERSION } from '@/lib/config'; // Create Context const LoadingContext = createContext<{ loading: boolean; setLoading: (state: boolean) => void; } | null>(null); // Custom Hook export function useLoading() { const context = useContext(LoadingContext); if (!context) { throw new Error('useLoading must be used within a LoadingProvider'); } return context; } // Provider Component export function LoadingProvider({ children }: { children: ReactNode }) { const [loading, setLoading] = useState(false); const [message, setMessage] = useState('Getting things ready for you'); useEffect(() => { let interval: NodeJS.Timeout; let dotCount = 0; function loadingMessage() { setMessage(`Getting things ready for you ${'.'.repeat(dotCount)}`); dotCount = (dotCount + 1) % 4; } interval = setInterval(loadingMessage, 300); return () => clearInterval(interval); }, []); return ( {loading && (
{/* Logo Animation */}
{/* Inner Background */}
{/* Text */}
NEXORA

{WEB_VERSION}

{/* Loading Bar */} {/* Loading Text */} {message}
)} {children} ); }