import React, { lazy, Suspense } from "react"; import { BrowserRouter, Navigate, Route, Routes, useParams } from "react-router-dom"; import { AuthProvider, useAuth } from "./context/AuthContext"; import { I18nProvider } from "./i18n/I18nProvider"; import { ToastProvider } from "./hooks/useToast"; import { AnnotationsProvider } from "./context/AnnotationsContext"; import { useTranslation } from "react-i18n-lite"; const LibraryPage = lazy(() => import("./pages/Library").then((m) => ({ default: m.LibraryPage }))); const BookDetailPage = lazy(() => import("./pages/BookDetailPage").then((m) => ({ default: m.BookDetailPage }))); const AddBookPage = lazy(() => import("./pages/AddBook").then((m) => ({ default: m.AddBookPage }))); const SettingsPage = lazy(() => import("./pages/Settings").then((m) => ({ default: m.SettingsPage }))); const BookmarksNotesPage = lazy(() => import("./components/annotations/BookmarksNotesPage").then((m) => ({ default: m.BookmarksNotesPage }))); const ReadingPage = lazy(() => import("./pages/ReadingPage").then((m) => ({ default: m.default }))); const AuthPage = lazy(() => import("./pages/AuthPage")); function LoadingFallback() { const { t } = useTranslation(); return

{t("common.loading")}

; } function ProtectedRoute({ children }: { children: React.ReactNode }) { const { isAuthenticated, loading } = useAuth(); if (loading) return ; if (!isAuthenticated) return ; return <>{children}; } function ReaderRedirect() { const { id } = useParams<{ id: string }>(); return ; } function AppRoutes() { const { isAuthenticated } = useAuth(); return ( }> : } /> } /> } /> } /> } /> } /> } /> } /> } /> ); } export default function App() { return ( ); }