import { Suspense, lazy } from 'react' import { Navigate, Route, Routes } from 'react-router-dom' import { Layout } from './components/Layout' import { RequireAdmin, RequireAuth } from './components/RequireAuth' import { LoginPage } from './pages/LoginPage' // Lazy-loaded routes — the login screen and the layout shell ship in the // initial bundle; everything else is fetched on first navigation. const HomePage = lazy(() => import('./pages/HomePage').then((m) => ({ default: m.HomePage }))) const LibraryPage = lazy(() => import('./pages/LibraryPage').then((m) => ({ default: m.LibraryPage })), ) const SearchPage = lazy(() => import('./pages/SearchPage').then((m) => ({ default: m.SearchPage })), ) const FavouritesPage = lazy(() => import('./pages/FavouritesPage').then((m) => ({ default: m.FavouritesPage })), ) const PlaylistsPage = lazy(() => import('./pages/PlaylistsPage').then((m) => ({ default: m.PlaylistsPage })), ) const PlaylistDetailPage = lazy(() => import('./pages/PlaylistDetailPage').then((m) => ({ default: m.PlaylistDetailPage })), ) const MediaDetailPage = lazy(() => import('./pages/MediaDetailPage').then((m) => ({ default: m.MediaDetailPage })), ) const PlayerPage = lazy(() => import('./pages/PlayerPage').then((m) => ({ default: m.PlayerPage })), ) const AdminPage = lazy(() => import('./pages/AdminPage').then((m) => ({ default: m.AdminPage }))) const DownloadsPage = lazy(() => import('./pages/DownloadsPage').then((m) => ({ default: m.DownloadsPage })), ) const SubscriptionsPage = lazy(() => import('./pages/SubscriptionsPage').then((m) => ({ default: m.SubscriptionsPage })), ) const ProfilePage = lazy(() => import('./pages/ProfilePage').then((m) => ({ default: m.ProfilePage })), ) const StatsPage = lazy(() => import('./pages/StatsPage').then((m) => ({ default: m.StatsPage }))) const DiscoverPage = lazy(() => import('./pages/DiscoverPage').then((m) => ({ default: m.DiscoverPage })), ) const TasksPage = lazy(() => import('./pages/TasksPage').then((m) => ({ default: m.TasksPage }))) const RecycleBinPage = lazy(() => import('./pages/RecycleBinPage').then((m) => ({ default: m.RecycleBinPage })), ) const DlnaPage = lazy(() => import('./pages/DlnaPage').then((m) => ({ default: m.DlnaPage }))) const FileManagerPage = lazy(() => import('./pages/FileManagerPage').then((m) => ({ default: m.FileManagerPage })), ) const APIConfigsPage = lazy(() => import('./pages/APIConfigsPage').then((m) => ({ default: m.APIConfigsPage })), ) const StoragePage = lazy(() => import('./pages/StoragePage').then((m) => ({ default: m.StoragePage })), ) const DuplicatesPage = lazy(() => import('./pages/DuplicatesPage').then((m) => ({ default: m.DuplicatesPage })), ) const SchedulerPage = lazy(() => import('./pages/SchedulerPage').then((m) => ({ default: m.SchedulerPage })), ) const WatchHistoryPage = lazy(() => import('./pages/WatchHistoryPage').then((m) => ({ default: m.WatchHistoryPage })), ) const PosterWallPage = lazy(() => import('./pages/PosterWallPage').then((m) => ({ default: m.PosterWallPage })), ) const SitesPage = lazy(() => import('./pages/SitesPage').then((m) => ({ default: m.SitesPage })), ) const SiteSearchPage = lazy(() => import('./pages/SiteSearchPage').then((m) => ({ default: m.SiteSearchPage })), ) const Loading = () =>
加载中…
export default function App() { return (