| import { Route, Routes } from "react-router-dom"; | |
| import { lazy, Suspense } from "react"; | |
| import { ErrorBoundary } from "@/components/ErrorBoundary"; | |
| import { Loader2 } from "lucide-react"; | |
| const Home = lazy(() => import("./pages/Home")); | |
| const Docs = lazy(() => import("./pages/Docs")); | |
| const Privacy = lazy(() => import("./pages/Privacy")); | |
| const Terms = lazy(() => import("./pages/Terms")); | |
| const NotFound = lazy(() => import("./pages/not-found")); | |
| function PageLoader() { | |
| return ( | |
| <div className="min-h-screen flex items-center justify-center bg-background"> | |
| <div className="text-center"> | |
| <Loader2 className="w-8 h-8 text-purple-400 animate-spin mx-auto mb-4" /> | |
| <p className="text-gray-400">Loading...</p> | |
| </div> | |
| </div> | |
| ); | |
| } | |
| export default function App() { | |
| return ( | |
| <ErrorBoundary> | |
| <Suspense fallback={<PageLoader />}> | |
| <Routes> | |
| <Route path="/" element={<Home />} /> | |
| <Route path="/docs" element={<Docs />} /> | |
| <Route path="/privacy" element={<Privacy />} /> | |
| <Route path="/terms" element={<Terms />} /> | |
| <Route path="*" element={<NotFound />} /> | |
| </Routes> | |
| </Suspense> | |
| </ErrorBoundary> | |
| ); | |
| } |