import { createBrowserRouter } from 'react-router-dom'; import { lazy, Suspense, type ReactNode } from 'react'; import { AppLayout } from '@/components/layout/AppLayout'; import { DashboardSkeleton, HomeSkeleton, LibrarySkeleton, WatchlistSkeleton, CollectionsSkeleton, CollectionDetailsSkeleton, EntryDetailsSkeleton, SeasonSkeleton, EpisodeSkeleton, PeopleSkeleton, PersonDetailsSkeleton, MediaSkeleton, CalendarSkeleton, SettingsSkeleton, } from '@/components/skeletons/PageSkeletons'; // Lazy-loaded pages const HomePage = lazy(() => import('@/pages/HomePage').then((m) => ({ default: m.HomePage })) ); const DashboardPage = lazy(() => import('@/pages/DashboardPage').then((m) => ({ default: m.DashboardPage })) ); const LibraryPage = lazy(() => import('@/pages/LibraryPage').then((m) => ({ default: m.LibraryPage })) ); const WatchlistPage = lazy(() => import('@/pages/WatchlistPage').then((m) => ({ default: m.WatchlistPage })) ); const CollectionsPage = lazy(() => import('@/pages/CollectionsPage').then((m) => ({ default: m.CollectionsPage, })) ); const CollectionDetailsPage = lazy(() => import('@/pages/CollectionDetailsPage').then((m) => ({ default: m.CollectionDetailsPage, })) ); const MediaPage = lazy(() => import('@/pages/MediaPage').then((m) => ({ default: m.MediaPage })) ); const CalendarPage = lazy(() => import('@/pages/CalendarPage').then((m) => ({ default: m.CalendarPage })) ); const EntryDetailsPage = lazy(() => import('@/pages/EntryDetailsPage').then((m) => ({ default: m.EntryDetailsPage, })) ); const TmdbPreviewPage = lazy(() => import('@/pages/TmdbPreviewPage').then((m) => ({ default: m.TmdbPreviewPage, })) ); const SeasonPage = lazy(() => import('@/pages/SeasonPage').then((m) => ({ default: m.SeasonPage })) ); const EpisodePage = lazy(() => import('@/pages/EpisodePage').then((m) => ({ default: m.EpisodePage })) ); const PeoplePage = lazy(() => import('@/pages/PeoplePage').then((m) => ({ default: m.PeoplePage })) ); const PersonDetailsPage = lazy(() => import('@/pages/PersonDetailsPage').then((m) => ({ default: m.PersonDetailsPage, })) ); const PersonTmdbRedirectPage = lazy(() => import('@/pages/PersonTmdbRedirectPage').then((m) => ({ default: m.PersonTmdbRedirectPage, })) ); const SettingsPage = lazy(() => import('@/pages/SettingsPage').then((m) => ({ default: m.SettingsPage })) ); const DiscoverPage = lazy(() => import('@/pages/DiscoverPage').then((m) => ({ default: m.DiscoverPage })) ); const SearchPage = lazy(() => import('@/pages/SearchPage').then((m) => ({ default: m.SearchPage })) ); function SuspensePage({ children, fallback }: { children: ReactNode; fallback?: ReactNode }) { return }>{children}; } export const router = createBrowserRouter([ { element: , children: [ { path: '/', element: ( }> ), }, { path: '/search', element: ( }> ), }, { path: '/dashboard', element: ( }> ), }, { path: '/library', element: ( }> ), }, { path: '/discover/:category', element: ( }> ), }, { path: '/watchlist', element: ( }> ), }, { path: '/collections', element: ( }> ), }, { path: '/collections/:id', element: ( }> ), }, { path: '/media', element: ( }> ), }, { path: '/calendar', element: ( }> ), }, { path: '/entry/tmdb/:type/:tmdbId', element: ( }> ), }, { path: '/entry/:id', element: ( }> ), }, { path: '/entry/:entryId/season/:seasonId', element: ( }> ), }, { path: '/entry/:entryId/season/:seasonId/episode/:episodeId', element: ( }> ), }, { path: '/people', element: ( }> ), }, { path: '/people/tmdb/:tmdbId', element: ( }> ), }, { path: '/people/:id', element: ( }> ), }, { path: '/settings', element: ( }> ), }, ], }, ]);