diff --git a/react_frontend/src/components/skeletons/PageSkeletons.tsx b/react_frontend/src/components/skeletons/PageSkeletons.tsx index bb887f6..da37ba6 100644 --- a/react_frontend/src/components/skeletons/PageSkeletons.tsx +++ b/react_frontend/src/components/skeletons/PageSkeletons.tsx @@ -154,28 +154,39 @@ export function CollectionDetailsSkeleton() { export function EntryDetailsSkeleton() { return (
-
-
-
- - - - +
+
+ +
+ + + +
+ + + +
+
+ + + + +
+
-
- - -
- - - +
+
+
+ + +
+
+
+ + +
-
- - - -
- +
diff --git a/react_frontend/src/pages/EntryDetailsPage.tsx b/react_frontend/src/pages/EntryDetailsPage.tsx index 03c658d..1c4c6a9 100644 --- a/react_frontend/src/pages/EntryDetailsPage.tsx +++ b/react_frontend/src/pages/EntryDetailsPage.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react"; +import { useState, useEffect, type ReactNode } from "react"; import { useParams, Link, useNavigate } from "react-router-dom"; import { useEntry, @@ -10,9 +10,7 @@ import { useEntrySeenByEntry, useDeleteEntrySeen } from "@/hooks/useEntrySeen"; import { useCollections } from "@/hooks/useCollections"; 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 { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { DropdownMenu, @@ -36,17 +34,19 @@ import { ExternalLink, Play, BookmarkCheck, + Film, + Tv, + Clock, + CalendarDays, } from "lucide-react"; import { Tooltip, TooltipContent, - TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; import { CastList } from "@/components/entries/CastList"; import { SeasonsContainer } from "@/components/entries/SeasonsContainer"; import { StreamingSection } from "@/components/streaming/StreamingSection"; -// EpisodeWatchHistory is available for future use import { EntrySettingsDialog } from "@/components/dialogs/EntrySettingsDialog"; import { EntrySeenDialog } from "@/components/dialogs/EntrySeenDialog"; import { EntryMediaDialog } from "@/components/dialogs/EntryMediaDialog"; @@ -78,29 +78,29 @@ const WATCH_STATUSES = [ value: "plan_to_watch", label: "Plan to Watch", color: - "bg-slate-500/15 border-slate-500/30 text-slate-600 dark:text-slate-400", + "bg-slate-500/15 border-slate-500/30 text-slate-600 dark:text-slate-300", }, { value: "watching", label: "Watching", - color: "bg-blue-500/15 border-blue-500/30 text-blue-600 dark:text-blue-400", + color: "bg-blue-500/15 border-blue-500/30 text-blue-600 dark:text-blue-300", }, { value: "completed", label: "Completed", color: - "bg-green-500/15 border-green-500/30 text-green-600 dark:text-green-400", + "bg-green-500/15 border-green-500/30 text-green-600 dark:text-green-300", }, { value: "on_hold", label: "On Hold", color: - "bg-amber-500/15 border-amber-500/30 text-amber-600 dark:text-amber-400", + "bg-amber-500/15 border-amber-500/30 text-amber-600 dark:text-amber-300", }, { value: "dropped", label: "Dropped", - color: "bg-red-500/15 border-red-500/30 text-red-600 dark:text-red-400", + color: "bg-red-500/15 border-red-500/30 text-red-600 dark:text-red-300", }, ]; @@ -167,411 +167,404 @@ export function EntryDetailsPage() { const director = credits.find( (c) => c.cast_type === "crew" && c.job === "Director", ); + const watchStatus = e.is_tvseries + ? getWatchStatusInfo(e.watch_status) + : undefined; + const userRating = e.entryRatings?.user_rating ?? 0; + const lastSeen = + watchHistory + .map((wh) => wh.date_seen) + .filter(Boolean) + .sort() + .at(-1) ?? null; const toggleFavorite = () => { updateEntry.mutate({ id: e.id, data: { favorit: !e.favorit } }); }; return ( -
- {/* Backdrop banner */} -
- {backdrop ? ( - - ) : ( -
- )} -
-
- - {/* Main content */} -
- {/* Action buttons — top right. The row overlaps the title below, so - only the button itself takes pointer events. */} -
- - - - - - {/* Watch & Rate */} - setShowSeenDialog(true)}> - - Mark as watched - - setShowRatingDialog(true)}> - - Rate this - - {e.is_tvseries && } - {e.is_tvseries && ( - setShowStatusDialog(true)}> - - Set Status - - )} - {!e.is_tvseries && ( - setShowWatchHistoryDialog(true)} - > - - Watch History - - )} - - {/* Organize */} - - - {e.favorit ? "Unfavorite" : "Favorite"} - - setShowCollectionDialog(true)}> - - Add to collection - - - updateEntry.mutate({ id: e.id, data: { hidden: !e.hidden } }) - } - > - - {e.hidden ? "Unhide" : "Hide"} - - - {/* Manage */} - refreshEntry.mutate(e.id)} - disabled={refreshEntry.isPending} - > - - {refreshEntry.isPending ? "Refreshing..." : "Refresh details"} - - setShowMediaDialog(true)}> - - Manage media - - setShowSettings(true)}> - - Settings - - - {/* Danger */} - setShowDeleteConfirm(true)} - > - - Delete entry - - - +
+ {/* ── Hero ── */} +
+
+ {backdrop ? ( + + ) : ( +
+ )} + {/* Fade into the page at the bottom and behind the text on the left */} +
+
- {/* Two-column header: sticky poster | info */} -
- {/* LEFT: Sticky poster */} -
+
+
- {/* External links */} - {e.entryIds && ( -
- {e.entryIds.tmdb_id && ( - - - TMDB - + +
+ {/* Eyebrow: type + status */} +
+ + {e.is_tvseries ? ( + + ) : ( + + )} + {e.is_tvseries ? "TV Series" : "Movie"} + + {e.is_tvseries && e.status && ( + + {e.status} + )} - {e.entryIds.imdb_id && ( - setShowStatusDialog(true)} + className={`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors ${ + watchStatus?.color ?? + "border-dashed border-border text-muted-foreground hover:text-foreground" + }`} > - - IMDb - + + {watchStatus?.label ?? "Set status"} + )}
- )} -
- {/* RIGHT: Entry info */} -
- {/* Title + director */} -
-

- {e.title} -

- {director?.people?.name && ( -

- by{" "} - - {director.people.name} - -

- )} -
+
+

+ {e.title} +

+ {e.original_title && e.original_title !== e.title && ( +

+ {e.original_title} +

+ )} +
- {/* Meta */} -
- {e.release_date && ( - + {/* Meta */} +
+ {e.release_date && ( - - - {getYear(e.release_date)} - + + } + > + {getYear(e.release_date)} -

{formatDate(e.release_date)}

+ {formatDate(e.release_date)}
- - )} - {e.is_tvseries && e.status && ( - <> - • - {e.status} - - )} - {e.runtime && !e.is_tvseries && ( - <> - • - {formatRuntime(e.runtime)} - - )} - {!e.is_tvseries && watchHistory.length > 0 && ( - <> - • - {watchHistory.length === 1 ? ( - Seen {formatDate(watchHistory[0].date_seen)} - ) : ( - - - - - Seen {watchHistory.length} times - - - -
- {watchHistory.map((wh) => ( -

{formatDate(wh.date_seen)}

- ))} -
-
-
-
- )} - - )} - {!e.is_tvseries && watchHistory.length === 0 && ( - <> - • - - - )} -
+ )} + {e.runtime && !e.is_tvseries && ( + {formatRuntime(e.runtime)} + )} + {e.is_tvseries && seasons && seasons.length > 0 && ( + + {seasons.length}{" "} + {seasons.length === 1 ? "season" : "seasons"} + + )} + {director?.people?.name && ( + + Directed by{" "} + + {director.people.name} + + + )} +
- {/* Genres */} - {e.genres && e.genres.length > 0 && ( -
- {e.genres.map((g) => ( - - 0 && ( +
+ {e.genres.map((g) => ( + {g.name} - - - ))} -
- )} - - {/* Ratings */} -
- {e.entryRatings?.imdb_rating != null && - e.entryRatings.imdb_rating > 0 && ( - - IMDb: - {e.entryRatings.imdb_rating}/10 - - )} - {e.entryRatings?.tmdb_rating != null && - e.entryRatings.tmdb_rating > 0 && ( - - TMDB: - {e.entryRatings.tmdb_rating.toFixed(1)}/10 - - )} - {e.entryRatings?.user_rating != null && - e.entryRatings.user_rating > 0 ? ( - - ) : ( - + + ))} +
)} - {/* Favorite pill */} - - - - - - -

- {e.favorit ? "Remove from favorites" : "Add to favorites"} -

-
-
-
- {/* Watch status pill — TV only */} - {e.is_tvseries && - e.watch_status && - (() => { - const info = getWatchStatusInfo(e.watch_status); - return ( - - ); - })()} + + + + {e.is_tvseries ? ( + setShowStatusDialog(true)} + > + + Set status + + ) : ( + setShowWatchHistoryDialog(true)} + > + + Watch history + + )} + + updateEntry.mutate({ + id: e.id, + data: { hidden: !e.hidden }, + }) + } + > + + {e.hidden ? "Unhide" : "Hide"} + + + refreshEntry.mutate(e.id)} + disabled={refreshEntry.isPending} + > + + {refreshEntry.isPending + ? "Refreshing..." + : "Refresh details"} + + setShowMediaDialog(true)} + > + + Manage media + + setShowSettings(true)}> + + Settings + + + setShowDeleteConfirm(true)} + > + + Delete entry + + + +
+
- - {/* Storyline */} - {e.storyline && ( -

- {e.storyline} -

- )}
+
- {/* Sections */} -
- {/* Streaming player + Trailer */} - + {/* ── Body ── */} +
+
+ {e.storyline && ( +
+

+ {e.storyline} +

+
+ )} {credits.length > 0 && ( - <> - - - + + )} + + {e.is_tvseries && seasons && seasons.length > 0 && ( + )} - - {e.is_tvseries && seasons && seasons.length > 0 && ( - <> - - - - )} - - {/* {watchHistory.length > 0 && ( - <> - - - deleteEntrySeen.mutate({ id: seenId, entryId: e.id }) - } - /> - - )} */}
+ + {/* ── Sidebar ── */} +
{/* Dialogs */} @@ -698,6 +691,149 @@ export function EntryDetailsPage() { ); } +/* ---------- Small building blocks ---------- */ + +function MetaItem({ children }: { children: ReactNode }) { + return ( + + + {children} + + ); +} + +function IconAction({ + label, + onClick, + disabled, + active, + children, +}: { + label: string; + onClick: () => void; + disabled?: boolean; + active?: boolean; + children: ReactNode; +}) { + return ( + + + } + > + {children} + + {label} + + ); +} + +function Section({ title, children }: { title: string; children: ReactNode }) { + return ( +
+

{title}

+ {children} +
+ ); +} + +function RatingTile({ + label, + value, + accent, + emptyLabel = "—", + onClick, +}: { + label: string; + value: string | null; + accent: string; + emptyLabel?: string; + onClick?: () => void; +}) { + const content = ( + <> + + {label} + + {value ? ( + + + {value} + + /10 + + ) : ( + + {emptyLabel} + + )} + + ); + const className = + "flex flex-col items-center gap-1 rounded-xl border border-border/60 bg-card/50 px-2 py-3"; + + return onClick ? ( + + ) : ( +
{content}
+ ); +} + +function DetailRow({ + icon, + label, + children, +}: { + icon: ReactNode; + label: string; + children: ReactNode; +}) { + return ( +
+
+ {icon} + {label} +
+
{children}
+
+ ); +} + +function ExternalChip({ + href, + children, +}: { + href: string; + children: ReactNode; +}) { + return ( + + + {children} + + ); +} + /* ---------- Collections section ---------- */ function EntryCollectionsSection({ entryId }: { entryId: number }) { const { data: allCollections = [], isLoading } = useCollections(); @@ -709,43 +845,39 @@ function EntryCollectionsSection({ entryId }: { entryId: number }) { if (isLoading || collections.length === 0) return null; return ( - <> - -
-

In Collections

- -
- {collections.map((col: Collection) => ( - -
- {col.name} -
-
-
-

- {col.name} +

+ +
+ {collections.map((col: Collection) => ( + +
+ {col.name} +
+
+
+

+ {col.name} +

+ {col.entries && ( +

+ {col.entries.length}{" "} + {col.entries.length === 1 ? "title" : "titles"}

- {col.entries && ( -

- {col.entries.length}{" "} - {col.entries.length === 1 ? "title" : "titles"} -

- )} -
- - ))} -
- - -
- + )} +
+ + ))} +
+ + + ); }