From 8671184dc559af9264624f03ce6ef31d538d0b6c Mon Sep 17 00:00:00 2001 From: X4Lo Date: Thu, 18 Jun 2026 13:37:39 +0100 Subject: [PATCH] Fix home page navigation and add TMDB cast page Home page cards now check library store and link directly to EntryDetailsPage when the entry is already added. Created useTmdbEntryLink hook for shared library-check logic. Added TmdbCastsPage with filter/search/sort for TMDB preview cast & crew, and limited credits to 12 on TmdbPreviewPage. --- .../src/components/entries/CastList.tsx | 61 ++-- .../src/components/home/BackdropCard.tsx | 33 ++- .../src/components/home/MiniPosterCard.tsx | 15 +- .../src/components/home/NumberedListItem.tsx | 16 +- .../src/components/home/UpcomingCard.tsx | 31 +- react_frontend/src/hooks/useTmdbEntryLink.ts | 42 +++ react_frontend/src/pages/TmdbCastsPage.tsx | 277 ++++++++++++++++++ react_frontend/src/pages/TmdbPreviewPage.tsx | 80 +++-- react_frontend/src/router.tsx | 121 ++++---- 9 files changed, 540 insertions(+), 136 deletions(-) create mode 100644 react_frontend/src/hooks/useTmdbEntryLink.ts create mode 100644 react_frontend/src/pages/TmdbCastsPage.tsx diff --git a/react_frontend/src/components/entries/CastList.tsx b/react_frontend/src/components/entries/CastList.tsx index dbb669c..26086b5 100644 --- a/react_frontend/src/components/entries/CastList.tsx +++ b/react_frontend/src/components/entries/CastList.tsx @@ -1,28 +1,45 @@ -import { Link } from 'react-router-dom'; -import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; -import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area'; -import { getProfileUrl } from '@/lib/media-utils'; -import { ChevronRight } from 'lucide-react'; -import type { Credit } from '@/types'; +import { Link } from "react-router-dom"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; +import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; +import { getProfileUrl } from "@/lib/media-utils"; +import { ChevronRight } from "lucide-react"; +import type { Credit } from "@/types"; interface CastListProps { credits: Credit[]; entryId?: number; isTvSeries?: boolean; + /** Limit visible cast cards (default: show all) */ + maxItems?: number; + /** Override link for "All Cast & Crew" — if unset, uses /entry/:entryId/cast */ + allCastHref?: string; } -export function CastList({ credits, entryId, isTvSeries }: CastListProps) { - const castCredits = credits.filter((c) => c.cast_type === 'cast'); +export function CastList({ + credits, + entryId, + isTvSeries, + maxItems, + allCastHref, +}: CastListProps) { + let castCredits = credits.filter((c) => c.cast_type === "cast"); + const hasMore = maxItems != null && castCredits.length > maxItems; + if (hasMore) { + castCredits = castCredits.slice(0, maxItems); + } if (castCredits.length === 0) return null; + const allCastLink = + allCastHref || (entryId != null ? `/entry/${entryId}/cast` : null); + return (

Cast

- {entryId != null && ( + {allCastLink && ( All Cast & Crew @@ -42,7 +59,13 @@ export function CastList({ credits, entryId, isTvSeries }: CastListProps) { ); } -function CastCard({ credit, isTvSeries }: { credit: Credit; isTvSeries?: boolean }) { +function CastCard({ + credit, + isTvSeries, +}: { + credit: Credit; + isTvSeries?: boolean; +}) { const profileUrl = credit.people?.profile_path ? getProfileUrl(credit.people.profile_path) : undefined; @@ -61,9 +84,9 @@ function CastCard({ credit, isTvSeries }: { credit: Credit; isTvSeries?: boolean {credit.people?.name - ?.split(' ') + ?.split(" ") .map((n) => n[0]) - .join('')} + .join("")}
@@ -73,11 +96,13 @@ function CastCard({ credit, isTvSeries }: { credit: Credit; isTvSeries?: boolean

{credit.character}

- {isTvSeries && credit.episode_count != null && credit.episode_count > 0 && ( -

- {credit.episode_count} ep. -

- )} + {isTvSeries && + credit.episode_count != null && + credit.episode_count > 0 && ( +

+ {credit.episode_count} ep. +

+ )}
); diff --git a/react_frontend/src/components/home/BackdropCard.tsx b/react_frontend/src/components/home/BackdropCard.tsx index b7bd684..a025b8d 100644 --- a/react_frontend/src/components/home/BackdropCard.tsx +++ b/react_frontend/src/components/home/BackdropCard.tsx @@ -1,6 +1,7 @@ -import { Link } from 'react-router-dom'; -import { Star } from 'lucide-react'; -import type { TmdbEntry } from '@/types'; +import { Link } from "react-router-dom"; +import { Star } from "lucide-react"; +import type { TmdbEntry } from "@/types"; +import { useTmdbEntryLink } from "@/hooks/useTmdbEntryLink"; interface BackdropCardProps { entry: TmdbEntry; @@ -9,19 +10,26 @@ interface BackdropCardProps { animDelay?: number; } -export function BackdropCard({ entry, showRating, animClass, animDelay }: BackdropCardProps) { - const title = entry.title || entry.name || 'Untitled'; +export function BackdropCard({ + entry, + showRating, + animClass, + animDelay, +}: BackdropCardProps) { + const title = entry.title || entry.name || "Untitled"; const backdrop = entry.backdrop_path ? `https://image.tmdb.org/t/p/w780${entry.backdrop_path}` : null; - const isTv = entry.media_type === 'tv' || !!entry.name; - const linkTo = `/entry/tmdb/${isTv ? 'tv' : 'movie'}/${entry.id}`; + const { linkTo } = useTmdbEntryLink(entry); return ( {backdrop ? ( {backdrop ? ( -
+
{poster ? (
- {poster && } + {poster && ( + + )}

{title}

diff --git a/react_frontend/src/components/home/UpcomingCard.tsx b/react_frontend/src/components/home/UpcomingCard.tsx index 642b400..8653fb5 100644 --- a/react_frontend/src/components/home/UpcomingCard.tsx +++ b/react_frontend/src/components/home/UpcomingCard.tsx @@ -1,11 +1,12 @@ -import { Link } from 'react-router-dom'; -import type { TmdbEntry } from '@/types'; +import { Link } from "react-router-dom"; +import type { TmdbEntry } from "@/types"; +import { useTmdbEntryLink } from "@/hooks/useTmdbEntryLink"; function formatRelativeTime(dateStr: string): string { const now = new Date(); const release = new Date(dateStr); const diffMs = release.getTime() - now.getTime(); - if (diffMs <= 0) return 'Out now'; + if (diffMs <= 0) return "Out now"; const totalMinutes = Math.floor(diffMs / 60000); const totalHours = Math.floor(totalMinutes / 60); const totalDays = Math.floor(totalHours / 24); @@ -13,10 +14,11 @@ function formatRelativeTime(dateStr: string): string { const remDays = totalDays % 30; if (months > 0 && remDays > 0) return `in ${months}m ${remDays}d`; if (months > 0) return `in ${months}m`; - if (totalDays > 0) return `in ${totalDays} day${totalDays !== 1 ? 's' : ''}`; - if (totalHours > 0) return `in ${totalHours} hour${totalHours !== 1 ? 's' : ''}`; + if (totalDays > 0) return `in ${totalDays} day${totalDays !== 1 ? "s" : ""}`; + if (totalHours > 0) + return `in ${totalHours} hour${totalHours !== 1 ? "s" : ""}`; if (totalMinutes > 0) return `in ${totalMinutes} min`; - return 'Very soon'; + return "Very soon"; } interface UpcomingCardProps { @@ -24,12 +26,11 @@ interface UpcomingCardProps { } export function UpcomingCard({ entry }: UpcomingCardProps) { - const title = entry.title || entry.name || 'Untitled'; + const title = entry.title || entry.name || "Untitled"; const poster = entry.poster_path ? `https://image.tmdb.org/t/p/w185${entry.poster_path}` : null; - const isTv = entry.media_type === 'tv' || !!entry.name; - const linkTo = `/entry/tmdb/${isTv ? 'tv' : 'movie'}/${entry.id}`; + const { linkTo } = useTmdbEntryLink(entry); const releaseDate = entry.release_date || entry.first_air_date; const relativeTime = releaseDate ? formatRelativeTime(releaseDate) : null; @@ -37,9 +38,9 @@ export function UpcomingCard({ entry }: UpcomingCardProps) { -
+
{poster ? (

- {new Date(releaseDate).toLocaleDateString('en-US', { - month: 'short', - day: 'numeric', - year: 'numeric', + {new Date(releaseDate).toLocaleDateString("en-US", { + month: "short", + day: "numeric", + year: "numeric", })}

diff --git a/react_frontend/src/hooks/useTmdbEntryLink.ts b/react_frontend/src/hooks/useTmdbEntryLink.ts new file mode 100644 index 0000000..01163f1 --- /dev/null +++ b/react_frontend/src/hooks/useTmdbEntryLink.ts @@ -0,0 +1,42 @@ +import { useMemo } from 'react'; +import { useLibraryStore } from '@/stores/useLibraryStore'; +import type { TmdbEntry } from '@/types'; + +interface TmdbEntryLink { + /** The resolved link — either /entry/:id if in library, or /entry/tmdb/:type/:id */ + linkTo: string; + /** Whether the entry is already in the user's library */ + isInLibrary: boolean; + /** The library Entry ID if found, otherwise null */ + libraryEntryId: number | null; +} + +/** + * Resolves the correct navigation link for a TmdbEntry. + * If the entry is already in the library, links directly to EntryDetailsPage. + * Otherwise, links to the TmdbPreviewPage. + */ +export function useTmdbEntryLink(entry: TmdbEntry): TmdbEntryLink { + const libraryEntries = useLibraryStore((s) => s.entries); + + return useMemo(() => { + const isTv = entry.media_type === 'tv' || !!entry.name; + const libraryEntry = Array.from(libraryEntries.values()).find( + (e) => e.entryIds?.tmdb_id === entry.id, + ); + + if (libraryEntry) { + return { + linkTo: `/entry/${libraryEntry.id}`, + isInLibrary: true, + libraryEntryId: libraryEntry.id, + }; + } + + return { + linkTo: `/entry/tmdb/${isTv ? 'tv' : 'movie'}/${entry.id}`, + isInLibrary: false, + libraryEntryId: null, + }; + }, [entry.id, libraryEntries]); +} diff --git a/react_frontend/src/pages/TmdbCastsPage.tsx b/react_frontend/src/pages/TmdbCastsPage.tsx new file mode 100644 index 0000000..ff1eda4 --- /dev/null +++ b/react_frontend/src/pages/TmdbCastsPage.tsx @@ -0,0 +1,277 @@ +import { useState, useMemo, useEffect, useRef } from "react"; +import { useParams, Link } from "react-router-dom"; +import { useTmdbPreview } from "@/hooks/useEntries"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; +import { Skeleton } from "@/components/ui/skeleton"; +import { Input } from "@/components/ui/input"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import type { Credit } from "@/types"; + +type SortField = "name" | "gender" | "popularity"; +type SortDir = "asc" | "desc"; +type CastFilter = "all" | "cast" | "crew"; + +const PAGE_SIZE = 24; + +const SORT_LABELS: Record = { + name: "Name", + gender: "Gender", + popularity: "Popularity", +}; + +const FILTER_LABELS: Record = { + all: "All", + cast: "Cast", + crew: "Crew", +}; + +function sortCredits( + credits: Credit[], + field: SortField, + dir: SortDir, +): Credit[] { + return [...credits].sort((a, b) => { + let cmp = 0; + switch (field) { + case "name": + cmp = (a.people?.name ?? "").localeCompare(b.people?.name ?? ""); + break; + case "gender": + cmp = (a.people?.gender ?? 0) - (b.people?.gender ?? 0); + break; + case "popularity": + cmp = (b.people?.popularity ?? 0) - (a.people?.popularity ?? 0); + break; + } + return dir === "asc" ? cmp : -cmp; + }); +} + +export function TmdbCastsPage() { + const { type, tmdbId } = useParams<{ type: string; tmdbId: string }>(); + const tmdbIdNum = parseInt(tmdbId!, 10); + const mediaType = type as "movie" | "tv"; + + const { data: preview, isLoading } = useTmdbPreview(tmdbIdNum, mediaType); + + const allCredits = (preview?.credits ?? []) as unknown as Credit[]; + + const [sortField, setSortField] = useState("popularity"); + const [sortDir, setSortDir] = useState("asc"); + const [filter, setFilter] = useState("cast"); + const [search, setSearch] = useState(""); + const [visibleCount, setVisibleCount] = useState(PAGE_SIZE); + + const filtered = useMemo(() => { + let result = allCredits; + if (filter === "cast") + result = result.filter((c) => c.cast_type === "cast"); + else if (filter === "crew") + result = result.filter((c) => c.cast_type === "crew"); + if (search.trim()) { + const q = search.trim().toLowerCase(); + result = result.filter((c) => { + const name = c.people?.name?.toLowerCase() ?? ""; + const role = + (c.cast_type === "cast" + ? c.character + : c.job || c.department + )?.toLowerCase() ?? ""; + return name.includes(q) || role.includes(q); + }); + } + return result; + }, [allCredits, filter, search]); + + const sorted = useMemo( + () => sortCredits(filtered, sortField, sortDir), + [filtered, sortField, sortDir], + ); + + useEffect(() => { + setVisibleCount(PAGE_SIZE); + }, [filter, sortField, sortDir, search]); + + const visible = useMemo( + () => sorted.slice(0, visibleCount), + [sorted, visibleCount], + ); + const hasMore = visibleCount < sorted.length; + + const sentinelRef = useRef(null); + useEffect(() => { + if (!hasMore) return; + const node = sentinelRef.current; + if (!node) return; + const observer = new IntersectionObserver( + (entries) => { + if (entries.some((e) => e.isIntersecting)) { + setVisibleCount((c) => Math.min(c + PAGE_SIZE, sorted.length)); + } + }, + { rootMargin: "400px 0px" }, + ); + observer.observe(node); + return () => observer.disconnect(); + }, [hasMore, sorted.length]); + + if (isLoading || !preview) { + return ( +
+ +
+ {Array.from({ length: 18 }).map((_, i) => ( +
+ + +
+ ))} +
+
+ ); + } + + const isTv = preview.is_tvseries; + + return ( +
+ {/* Breadcrumb */} +
+ + {preview.title} + + / + Cast & Crew +
+ + {/* Controls */} +
+ setSearch(e.target.value)} + className="w-48" + /> + + {sorted.length} {sorted.length === 1 ? "credit" : "credits"} + + +
+ + + +
+
+ + {/* Grid */} + {sorted.length === 0 ? ( +

+ No credits found. +

+ ) : ( + <> +
+ {visible.map((credit) => ( + + ))} +
+ {hasMore && ( +
+
+ {Array.from({ + length: Math.min(PAGE_SIZE, sorted.length - visibleCount), + }).map((_, i) => ( +
+ + +
+ ))} +
+
+ )} + + )} +
+ ); +} + +function TmdbCreditCard({ credit, isTv }: { credit: Credit; isTv: boolean }) { + const profileUrl = credit.people?.profile_path + ? `https://image.tmdb.org/t/p/w185${credit.people.profile_path}` + : undefined; + + const personLink = credit.entry_id + ? `/people/${credit.people_id}` + : `/people/tmdb/${credit.people?.tmdb_id ?? credit.people_id}`; + + const roleLabel = + credit.cast_type === "cast" + ? credit.character + : credit.job || credit.department; + + return ( + + + + + {credit.people?.name + ?.split(" ") + .map((n) => n[0]) + .join("")} + + +
+

+ {credit.people?.name} +

+ {roleLabel && ( +

+ {roleLabel} +

+ )} + {isTv && credit.episode_count != null && credit.episode_count > 0 && ( +

+ {credit.episode_count}{" "} + {credit.episode_count === 1 ? "episode" : "episodes"} +

+ )} +
+ + ); +} diff --git a/react_frontend/src/pages/TmdbPreviewPage.tsx b/react_frontend/src/pages/TmdbPreviewPage.tsx index 72e0f1c..8c7233b 100644 --- a/react_frontend/src/pages/TmdbPreviewPage.tsx +++ b/react_frontend/src/pages/TmdbPreviewPage.tsx @@ -1,26 +1,30 @@ -import { useParams, useNavigate } from 'react-router-dom'; -import { useEffect } from 'react'; -import { useTmdbPreview, useCreateEntry } from '@/hooks/useEntries'; -import { useLibraryStore } from '@/stores/useLibraryStore'; -import { useCommandPaletteStore } from '@/stores/useCommandPaletteStore'; -import { Badge } from '@/components/ui/badge'; -import { Button } from '@/components/ui/button'; -import { Separator } from '@/components/ui/separator'; -import { Star, Plus, Loader2, ExternalLink } from 'lucide-react'; -import { EntryDetailsSkeleton } from '@/components/skeletons/PageSkeletons'; +import { useParams, useNavigate } from "react-router-dom"; +import { useEffect } from "react"; +import { useTmdbPreview, useCreateEntry } from "@/hooks/useEntries"; +import { useLibraryStore } from "@/stores/useLibraryStore"; +import { useCommandPaletteStore } from "@/stores/useCommandPaletteStore"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Separator } from "@/components/ui/separator"; +import { Star, Plus, Loader2, ExternalLink } from "lucide-react"; +import { EntryDetailsSkeleton } from "@/components/skeletons/PageSkeletons"; import { CastList } from "@/components/entries/CastList"; -import { getYear, formatRuntime } from '@/lib/media-utils'; -import type { Credit } from '@/types'; +import { getYear, formatRuntime } from "@/lib/media-utils"; +import type { Credit } from "@/types"; -const TMDB_IMG = 'https://image.tmdb.org/t/p'; +const TMDB_IMG = "https://image.tmdb.org/t/p"; export function TmdbPreviewPage() { const { type, tmdbId } = useParams<{ type: string; tmdbId: string }>(); const navigate = useNavigate(); const tmdbIdNum = parseInt(tmdbId!, 10); - const mediaType = type as 'movie' | 'tv'; + const mediaType = type as "movie" | "tv"; - const { data: preview, isLoading, isError } = useTmdbPreview(tmdbIdNum, mediaType); + const { + data: preview, + isLoading, + isError, + } = useTmdbPreview(tmdbIdNum, mediaType); const createEntry = useCreateEntry(); // Check if already in library @@ -61,20 +65,27 @@ export function TmdbPreviewPage() { return (

Could not load entry from TMDB.

- +
); } - const backdrop = preview.backdrop_path ? `${TMDB_IMG}/w1280${preview.backdrop_path}` : null; + const backdrop = preview.backdrop_path + ? `${TMDB_IMG}/w1280${preview.backdrop_path}` + : null; const poster = preview.poster_path ? `${TMDB_IMG}/w500${preview.poster_path}` - : '/images/default-poster.png'; + : "/images/default-poster.png"; const handleAddToLibrary = () => { createEntry.mutate( { tmdb_id: preview.tmdb_id, is_tvserie: preview.is_tvseries }, - { onSuccess: (newEntry) => navigate(`/entry/${newEntry.id}`, { replace: true }) } + { + onSuccess: (newEntry) => + navigate(`/entry/${newEntry.id}`, { replace: true }), + }, ); }; @@ -99,17 +110,23 @@ export function TmdbPreviewPage() { {/* Add to Library button — top right */}
{libraryEntry ? ( - ) : ( - )}
@@ -127,7 +144,7 @@ export function TmdbPreviewPage() {
{preview.tmdb_id && ( {/* Title */}
-

{preview.title}

+

+ {preview.title} +

{/* Meta */}
- {preview.release_date && {getYear(preview.release_date)}} + {preview.release_date && ( + {getYear(preview.release_date)} + )} {preview.is_tvseries && preview.status && ( <> • @@ -178,7 +199,8 @@ export function TmdbPreviewPage() { {preview.is_tvseries && preview.number_of_seasons != null && (
- {preview.number_of_seasons} {preview.number_of_seasons === 1 ? 'Season' : 'Seasons'} + {preview.number_of_seasons}{" "} + {preview.number_of_seasons === 1 ? "Season" : "Seasons"} {preview.number_of_episodes != null && ( @@ -225,7 +247,11 @@ export function TmdbPreviewPage() { {preview.credits && preview.credits.length > 0 && ( <> - + )}
diff --git a/react_frontend/src/router.tsx b/react_frontend/src/router.tsx index 26143e2..eb921eb 100644 --- a/react_frontend/src/router.tsx +++ b/react_frontend/src/router.tsx @@ -1,6 +1,6 @@ -import { createBrowserRouter, createHashRouter } from 'react-router-dom'; -import { lazy, Suspense, type ReactNode } from 'react'; -import { AppLayout } from '@/components/layout/AppLayout'; +import { createBrowserRouter, createHashRouter } from "react-router-dom"; +import { lazy, Suspense, type ReactNode } from "react"; +import { AppLayout } from "@/components/layout/AppLayout"; import { DashboardSkeleton, HomeSkeleton, @@ -16,81 +16,94 @@ import { MediaSkeleton, CalendarSkeleton, SettingsSkeleton, -} from '@/components/skeletons/PageSkeletons'; +} from "@/components/skeletons/PageSkeletons"; // Lazy-loaded pages const HomePage = lazy(() => - import('@/pages/HomePage').then((m) => ({ default: m.HomePage })) + import("@/pages/HomePage").then((m) => ({ default: m.HomePage })), ); const DashboardPage = lazy(() => - import('@/pages/DashboardPage').then((m) => ({ default: m.DashboardPage })) + import("@/pages/DashboardPage").then((m) => ({ default: m.DashboardPage })), ); const LibraryPage = lazy(() => - import('@/pages/LibraryPage').then((m) => ({ default: m.LibraryPage })) + import("@/pages/LibraryPage").then((m) => ({ default: m.LibraryPage })), ); const WatchlistPage = lazy(() => - import('@/pages/WatchlistPage').then((m) => ({ default: m.WatchlistPage })) + import("@/pages/WatchlistPage").then((m) => ({ default: m.WatchlistPage })), ); const CollectionsPage = lazy(() => - import('@/pages/CollectionsPage').then((m) => ({ + import("@/pages/CollectionsPage").then((m) => ({ default: m.CollectionsPage, - })) + })), ); const CollectionDetailsPage = lazy(() => - import('@/pages/CollectionDetailsPage').then((m) => ({ + import("@/pages/CollectionDetailsPage").then((m) => ({ default: m.CollectionDetailsPage, - })) + })), ); const MediaPage = lazy(() => - import('@/pages/MediaPage').then((m) => ({ default: m.MediaPage })) + import("@/pages/MediaPage").then((m) => ({ default: m.MediaPage })), ); const CalendarPage = lazy(() => - import('@/pages/CalendarPage').then((m) => ({ default: m.CalendarPage })) + import("@/pages/CalendarPage").then((m) => ({ default: m.CalendarPage })), ); const EntryDetailsPage = lazy(() => - import('@/pages/EntryDetailsPage').then((m) => ({ + import("@/pages/EntryDetailsPage").then((m) => ({ default: m.EntryDetailsPage, - })) + })), ); const TmdbPreviewPage = lazy(() => - import('@/pages/TmdbPreviewPage').then((m) => ({ + import("@/pages/TmdbPreviewPage").then((m) => ({ default: m.TmdbPreviewPage, - })) + })), +); +const TmdbCastsPage = lazy(() => + import("@/pages/TmdbCastsPage").then((m) => ({ + default: m.TmdbCastsPage, + })), ); const SeasonPage = lazy(() => - import('@/pages/SeasonPage').then((m) => ({ default: m.SeasonPage })) + import("@/pages/SeasonPage").then((m) => ({ default: m.SeasonPage })), ); const EpisodePage = lazy(() => - import('@/pages/EpisodePage').then((m) => ({ default: m.EpisodePage })) + import("@/pages/EpisodePage").then((m) => ({ default: m.EpisodePage })), ); const EntryCastsPage = lazy(() => - import('@/pages/EntryCastsPage').then((m) => ({ + import("@/pages/EntryCastsPage").then((m) => ({ default: m.EntryCastsPage, - })) + })), ); const PeoplePage = lazy(() => - import('@/pages/PeoplePage').then((m) => ({ default: m.PeoplePage })) + import("@/pages/PeoplePage").then((m) => ({ default: m.PeoplePage })), ); const PersonDetailsPage = lazy(() => - import('@/pages/PersonDetailsPage').then((m) => ({ + import("@/pages/PersonDetailsPage").then((m) => ({ default: m.PersonDetailsPage, - })) + })), ); const SettingsPage = lazy(() => - import('@/pages/SettingsPage').then((m) => ({ default: m.SettingsPage })) + import("@/pages/SettingsPage").then((m) => ({ default: m.SettingsPage })), ); const DiscoverPage = lazy(() => - import('@/pages/DiscoverPage').then((m) => ({ default: m.DiscoverPage })) + import("@/pages/DiscoverPage").then((m) => ({ default: m.DiscoverPage })), ); const SearchPage = lazy(() => - import('@/pages/SearchPage').then((m) => ({ default: m.SearchPage })) + import("@/pages/SearchPage").then((m) => ({ default: m.SearchPage })), ); -function SuspensePage({ children, fallback }: { children: ReactNode; fallback?: ReactNode }) { - return }>{children}; +function SuspensePage({ + children, + fallback, +}: { + children: ReactNode; + fallback?: ReactNode; +}) { + return ( + }>{children} + ); } -const isElectron = import.meta.env.VITE_ELECTRON === 'true'; +const isElectron = import.meta.env.VITE_ELECTRON === "true"; const createRouter = isElectron ? createHashRouter : createBrowserRouter; export const router = createRouter([ @@ -98,7 +111,7 @@ export const router = createRouter([ element: , children: [ { - path: '/', + path: "/", element: ( }> @@ -106,7 +119,7 @@ export const router = createRouter([ ), }, { - path: '/search', + path: "/search", element: ( }> @@ -114,7 +127,7 @@ export const router = createRouter([ ), }, { - path: '/dashboard', + path: "/dashboard", element: ( }> @@ -122,7 +135,7 @@ export const router = createRouter([ ), }, { - path: '/library', + path: "/library", element: ( }> @@ -130,7 +143,7 @@ export const router = createRouter([ ), }, { - path: '/discover/:category', + path: "/discover/:category", element: ( }> @@ -138,7 +151,7 @@ export const router = createRouter([ ), }, { - path: '/watchlist', + path: "/watchlist", element: ( }> @@ -146,7 +159,7 @@ export const router = createRouter([ ), }, { - path: '/collections', + path: "/collections", element: ( }> @@ -154,7 +167,7 @@ export const router = createRouter([ ), }, { - path: '/collections/:id', + path: "/collections/:id", element: ( }> @@ -162,7 +175,7 @@ export const router = createRouter([ ), }, { - path: '/media', + path: "/media", element: ( }> @@ -170,7 +183,7 @@ export const router = createRouter([ ), }, { - path: '/calendar', + path: "/calendar", element: ( }> @@ -178,7 +191,15 @@ export const router = createRouter([ ), }, { - path: '/entry/tmdb/:type/:tmdbId', + path: "/entry/tmdb/:type/:tmdbId/cast", + element: ( + }> + + + ), + }, + { + path: "/entry/tmdb/:type/:tmdbId", element: ( }> @@ -186,7 +207,7 @@ export const router = createRouter([ ), }, { - path: '/entry/:id', + path: "/entry/:id", element: ( }> @@ -194,7 +215,7 @@ export const router = createRouter([ ), }, { - path: '/entry/:id/cast', + path: "/entry/:id/cast", element: ( }> @@ -202,7 +223,7 @@ export const router = createRouter([ ), }, { - path: '/entry/:entryId/season/:seasonId', + path: "/entry/:entryId/season/:seasonId", element: ( }> @@ -210,7 +231,7 @@ export const router = createRouter([ ), }, { - path: '/entry/:entryId/season/:seasonId/episode/:episodeId', + path: "/entry/:entryId/season/:seasonId/episode/:episodeId", element: ( }> @@ -218,7 +239,7 @@ export const router = createRouter([ ), }, { - path: '/people', + path: "/people", element: ( }> @@ -226,7 +247,7 @@ export const router = createRouter([ ), }, { - path: '/people/tmdb/:tmdbId', + path: "/people/tmdb/:tmdbId", element: ( }> @@ -234,7 +255,7 @@ export const router = createRouter([ ), }, { - path: '/people/:id', + path: "/people/:id", element: ( }> @@ -242,7 +263,7 @@ export const router = createRouter([ ), }, { - path: '/settings', + path: "/settings", element: ( }>