import { lazy, Suspense, useEffect, useRef } from "react"; import { BrowserRouter, Navigate, Route, Routes, ScrollRestoration, } from "react-router-dom"; import { ProtectedRoute, PublicRoute } from "./components/RouteGuards"; import SplashScreen from "./components/SplashScreen"; import { ROUTES } from "./config/routes"; import { useAuth } from "./hooks/useAuth"; const Activate = lazy(() => import("./pages/Activate")); const Drawer = lazy(() => import("./pages/Drawer")); const Editor = lazy(() => import("./pages/Editor")); const Home = lazy(() => import("./pages/Home")); const Login = lazy(() => import("./pages/Login")); const Reader = lazy(() => import("./pages/Reader")); const Register = lazy(() => import("./pages/Register")); const VerifyEmail = lazy(() => import("./pages/VerifyEmail")); const About = lazy(() => import("./pages/About")); export default function App() { const { initialize, isInitializing } = useAuth(); const authInitialized = useRef(false); useEffect(() => { if (authInitialized.current) return; authInitialized.current = true; initialize().then(); }, [initialize]); if (isInitializing) { return ; } return (
}> } /> } /> } /> } /> } /> } /> } /> } /> } /> } />
); }