feat(frontend): Entry details redesign, people filmography, calendar improvements

- EntryDetailsPage: sticky poster layout, centered max-w-4xl, director by-line
  with link, rating pills (IMDb/TMDB/You), quick actions under poster, RatingDialog
  with star UI, In Collections section using backdrops, EntrySettingsDialog with
  show_in_calendar / auto_sync / rating options
- RatingDialog: new component with 10-star interactive rating
- AddEntryToCollectionDialog: optimistic cache updates so checkbox state reflects
  immediately and In Collections section on entry details page refreshes
- PersonDetailsPage: filmography section showing library vs. non-library entries
  via person.roles, TMDB combined credits for non-library titles
- PersonTmdbRedirectPage: new redirect page for TMDB person IDs to local person ID
- PeoplePage: fix person card links to use /people/tmdb/:tmdbId
- CalendarPage: full-height layout, larger episode thumbnails, episode items
  clickable, improved tooltip, show_in_calendar backend filter
- Fix useUpdateEntry to also invalidate entryKeys.all (favorite button reactivity)
- Fix updateRatings API body wrapping
- Add useUpdateEntryRatings, usePersonCredits, useFetchPersonByTmdbId hooks
- Add getCollectionBackdropUrl to media-utils
- Types: show_in_calendar, auto_sync on Entry; id on EntryRatings; roles on People
- Backend: fix fetchPersonData alias in peopleService; remove duplicate
  getPersonCredits; add show_in_calendar filter to episodeService
This commit is contained in:
Mohammed Abad committed 2026-04-01 00:25:30 +01:00
1 parent 11eab03987
commit 3ca24434d7
16 files changed
+857 -322

No files matched your search

+239 -162
View File
@@ -1,12 +1,14 @@
import { useState } from 'react';
import { useParams } from 'react-router-dom';
import { useParams, Link } from 'react-router-dom';
import { useEntry, useEntrySeasons, useRefreshEntry } from '@/hooks/useEntries';
import { useEntrySeenByEntry, useDeleteEntrySeen } from '@/hooks/useEntrySeen';
import { useCollections } from '@/hooks/useCollections';
import { useLibraryStore } from '@/stores/useLibraryStore';
import { Skeleton } from '@/components/ui/skeleton';
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,
DropdownMenuContent,
@@ -33,20 +35,21 @@ import {
import { CastList } from '@/components/entries/CastList';
import { SeasonsContainer } from '@/components/entries/SeasonsContainer';
import { EpisodeWatchHistory } from '@/components/entries/EpisodeWatchHistory';
import { CollectionsGrid } from '@/components/collections/CollectionsGrid';
import { EntrySettingsDialog } from '@/components/dialogs/EntrySettingsDialog';
import { EntrySeenDialog } from '@/components/dialogs/EntrySeenDialog';
import { EntryMediaDialog } from '@/components/dialogs/EntryMediaDialog';
import { AddEntryToCollectionDialog } from '@/components/dialogs/AddEntryToCollectionDialog';
import { RatingDialog } from '@/components/dialogs/RatingDialog';
import {
getPosterUrl,
getBackdropUrl,
getCollectionBackdropUrl,
getYear,
formatRuntime,
formatDate,
} from '@/lib/media-utils';
import { useUpdateEntry } from '@/hooks/useEntries';
import type { Entry } from '@/types';
import type { Collection, Entry } from '@/types';
export function EntryDetailsPage() {
const { id } = useParams<{ id: string }>();
@@ -64,11 +67,11 @@ export function EntryDetailsPage() {
? { ...libraryEntry, ...entry, isInLibrary: true }
: entry || libraryEntry;
// Dialog states
const [showSettings, setShowSettings] = useState(false);
const [showSeenDialog, setShowSeenDialog] = useState(false);
const [showMediaDialog, setShowMediaDialog] = useState(false);
const [showCollectionDialog, setShowCollectionDialog] = useState(false);
const [showRatingDialog, setShowRatingDialog] = useState(false);
if (isLoading || !displayEntry) {
return <EntryDetailsSkeleton />;
@@ -86,37 +89,120 @@ export function EntryDetailsPage() {
};
return (
<div className="space-y-8">
{/* Hero Section */}
<div className="relative -mx-6 -mt-6 overflow-hidden">
{backdrop && (
<div>
{/* Backdrop banner */}
<div className="relative -mx-6 -mt-6 h-52 overflow-hidden">
{backdrop ? (
<img
src={backdrop}
alt=""
className="h-72 w-full object-cover opacity-30 blur-sm"
className="h-full w-full object-cover opacity-25 blur-sm scale-105"
/>
) : (
<div className="h-full w-full bg-linear-to-br from-primary/15 to-primary/5" />
)}
<div className="absolute inset-0 bg-gradient-to-t from-background to-transparent" />
<div className="absolute inset-0 bg-linear-to-t from-background via-background/60 to-transparent" />
</div>
<div className="relative mx-auto flex max-w-5xl gap-6 px-6 pb-6 pt-4">
{/* Poster */}
<div className="shrink-0">
{/* Main content */}
<div className="mx-auto max-w-4xl">
{/* Two-column header: sticky poster | info */}
<div className="flex gap-8 -mt-24 relative items-start">
{/* LEFT: Sticky poster + actions */}
<div className="sticky top-20 w-44 shrink-0 space-y-3 self-start">
<img
src={poster}
alt={e.title}
className="h-72 w-48 rounded-lg object-cover shadow-lg"
className="w-full aspect-2/3 rounded-xl object-cover shadow-2xl ring-1 ring-border/50"
/>
<div className="flex flex-col gap-2">
<Button
variant={e.favorit ? 'default' : 'outline'}
size="sm"
className="w-full justify-start"
onClick={toggleFavorite}
>
<Heart className={`mr-2 h-4 w-4 ${e.favorit ? 'fill-current' : ''}`} />
{e.favorit ? 'Favorited' : 'Favorite'}
</Button>
<Button
variant="outline"
size="sm"
className="w-full justify-start"
onClick={() => setShowSeenDialog(true)}
>
<Eye className="mr-2 h-4 w-4" />
Mark Watched
</Button>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="sm" className="w-full justify-start">
<MoreHorizontal className="mr-2 h-4 w-4" />
More actions
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" side="right" className="w-56">
<DropdownMenuItem onClick={() => setShowRatingDialog(true)}>
<Star className="mr-2 h-4 w-4" />
Rate this
</DropdownMenuItem>
<DropdownMenuItem
onClick={() =>
updateEntry.mutate({ id: e.id, data: { hidden: !e.hidden } })
}
>
<EyeOff className="mr-2 h-4 w-4" />
{e.hidden ? 'Unhide' : 'Hide'}
</DropdownMenuItem>
<DropdownMenuItem onClick={() => refreshEntry.mutate(e.id)}>
<RefreshCw className="mr-2 h-4 w-4" />
Refresh details
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setShowCollectionDialog(true)}>
<FolderPlus className="mr-2 h-4 w-4" />
Add to collection
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setShowMediaDialog(true)}>
<ImageIcon className="mr-2 h-4 w-4" />
Manage media
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setShowSettings(true)}>
<Settings className="mr-2 h-4 w-4" />
Settings
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
{/* Info */}
<div className="flex flex-1 flex-col justify-end space-y-3">
<div className="flex items-center gap-3">
<h1 className="text-3xl font-bold">{e.title}</h1>
{e.status && (
<Badge variant="secondary">{e.status}</Badge>
{/* RIGHT: Entry info */}
<div className="flex-1 min-w-0 space-y-4">
{/* Title + status + director */}
<div className="space-y-1">
<div className="flex flex-wrap items-start gap-2">
<h1 className="text-3xl font-bold leading-tight">{e.title}</h1>
{e.status && (
<Badge variant="secondary" className="mt-1 shrink-0">
{e.status}
</Badge>
)}
</div>
{director && (
<p className="text-sm text-muted-foreground">
by{' '}
<Link
to={`/people/${director.people_id}`}
className="font-medium text-foreground hover:underline"
>
{director.people?.name}
</Link>
</p>
)}
</div>
{/* Meta */}
<div className="flex flex-wrap items-center gap-2 text-sm text-muted-foreground">
{e.release_date && (
<TooltipProvider>
@@ -138,12 +224,6 @@ export function EntryDetailsPage() {
<span>{formatRuntime(e.runtime)}</span>
</>
)}
{director && (
<>
<span>•</span>
<span>Dir. {director.people?.name}</span>
</>
)}
</div>
{/* Genres */}
@@ -158,145 +238,83 @@ export function EntryDetailsPage() {
)}
{/* Ratings */}
<div className="flex items-center gap-4">
{e.entryRatings?.user_rating != null &&
e.entryRatings.user_rating > 0 && (
<div className="flex items-center gap-1">
<Star className="h-4 w-4 fill-yellow-400 text-yellow-400" />
<span className="text-sm font-medium">
{e.entryRatings.user_rating}/10
</span>
<span className="text-xs text-muted-foreground">You</span>
</div>
<div className="flex flex-wrap items-center gap-2">
{e.entryRatings?.imdb_rating != null &&
e.entryRatings.imdb_rating > 0 && (
<span className="inline-flex items-center gap-1 rounded-full bg-yellow-500/10 border border-yellow-500/20 px-3 py-1 text-sm text-yellow-600 dark:text-yellow-400 font-medium">
<span className="font-bold">IMDb:</span>
{e.entryRatings.imdb_rating}/10
</span>
)}
{e.entryRatings?.tmdb_rating != null &&
e.entryRatings.tmdb_rating > 0 && (
<div className="flex items-center gap-1">
<span className="text-sm font-medium">
{e.entryRatings.tmdb_rating.toFixed(1)}
</span>
<span className="text-xs text-muted-foreground">TMDB</span>
</div>
)}
{e.entryRatings?.imdb_rating != null &&
e.entryRatings.imdb_rating > 0 && (
<div className="flex items-center gap-1">
<span className="text-sm font-medium">
{e.entryRatings.imdb_rating}
</span>
<span className="text-xs text-muted-foreground">IMDb</span>
</div>
<span className="inline-flex items-center gap-1 rounded-full bg-blue-500/10 border border-blue-500/20 px-3 py-1 text-sm text-blue-600 dark:text-blue-400 font-medium">
<span className="font-bold">TMDB:</span>
{e.entryRatings.tmdb_rating.toFixed(1)}/10
</span>
)}
{e.entryRatings?.user_rating != null &&
e.entryRatings.user_rating > 0 ? (
<button
className="inline-flex items-center gap-1 rounded-full bg-accent border border-border px-3 py-1 text-sm font-medium hover:bg-accent/80 transition-colors"
onClick={() => setShowRatingDialog(true)}
title="Click to change rating"
>
<Star className="h-3.5 w-3.5 fill-yellow-400 text-yellow-400" />
<span className="font-bold">You:</span>
{e.entryRatings.user_rating}/10
</button>
) : (
<button
className="inline-flex items-center gap-1.5 rounded-full border border-dashed border-border px-3 py-1 text-sm text-muted-foreground hover:border-border hover:text-foreground transition-colors"
onClick={() => setShowRatingDialog(true)}
>
<Star className="h-3.5 w-3.5" />
Rate
</button>
)}
</div>
{/* Actions */}
<div className="flex items-center gap-2 pt-2">
<Button
variant={e.favorit ? 'default' : 'outline'}
size="sm"
onClick={toggleFavorite}
>
<Heart
className={`mr-1 h-4 w-4 ${
e.favorit ? 'fill-current' : ''
}`}
/>
{e.favorit ? 'Favorited' : 'Favorite'}
</Button>
<Button
variant="outline"
size="sm"
onClick={() => setShowSeenDialog(true)}
>
<Eye className="mr-1 h-4 w-4" />
Mark Watched
</Button>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size="icon" className="h-8 w-8">
<MoreHorizontal className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem
onClick={() =>
updateEntry.mutate({
id: e.id,
data: { hidden: !e.hidden },
})
}
>
<EyeOff className="mr-2 h-4 w-4" />
{e.hidden ? 'Unhide' : 'Hide'}
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => refreshEntry.mutate(e.id)}
>
<RefreshCw className="mr-2 h-4 w-4" />
Refresh Details
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setShowCollectionDialog(true)}
>
<FolderPlus className="mr-2 h-4 w-4" />
Add to Collection
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setShowMediaDialog(true)}
>
<ImageIcon className="mr-2 h-4 w-4" />
Media
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setShowSettings(true)}
>
<Settings className="mr-2 h-4 w-4" />
Settings
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
{/* Storyline */}
{e.storyline && (
<p className="text-sm text-muted-foreground leading-relaxed max-w-prose">
{e.storyline}
</p>
)}
</div>
</div>
</div>
{/* Storyline */}
{e.storyline && (
<div className="space-y-2">
<h3 className="text-lg font-semibold">Overview</h3>
<p className="text-sm text-muted-foreground leading-relaxed">
{e.storyline}
</p>
{/* Sections */}
<div className="mt-10 space-y-8">
{e.credits && e.credits.length > 0 && (
<>
<Separator />
<CastList credits={e.credits} />
</>
)}
<EntryCollectionsSection entryId={e.id} />
{e.is_tvseries && seasons && seasons.length > 0 && (
<>
<Separator />
<SeasonsContainer seasons={seasons} entryId={e.id} />
</>
)}
{watchHistory.length > 0 && (
<>
<Separator />
<EpisodeWatchHistory
watchHistory={watchHistory}
onDelete={(seenId) =>
deleteEntrySeen.mutate({ id: seenId, entryId: e.id })
}
/>
</>
)}
</div>
)}
<Separator />
{/* Cast */}
{e.credits && e.credits.length > 0 && <CastList credits={e.credits} />}
{/* Seasons (TV only) */}
{e.is_tvseries && seasons && seasons.length > 0 && (
<>
<Separator />
<SeasonsContainer seasons={seasons} entryId={e.id} />
</>
)}
{/* Watch History */}
{watchHistory.length > 0 && (
<>
<Separator />
<EpisodeWatchHistory
watchHistory={watchHistory}
onDelete={(seenId) =>
deleteEntrySeen.mutate({ id: seenId, entryId: e.id })
}
/>
</>
)}
</div>
{/* Dialogs */}
{showSettings && (
@@ -330,22 +348,81 @@ export function EntryDetailsPage() {
entryId={e.id}
/>
)}
{showRatingDialog && (
<RatingDialog
open={showRatingDialog}
onOpenChange={setShowRatingDialog}
entry={e}
/>
)}
</div>
);
}
/* ---------- Collections section ---------- */
function EntryCollectionsSection({ entryId }: { entryId: number }) {
const { data: allCollections = [], isLoading } = useCollections();
const collections = allCollections.filter((col: Collection) =>
col.entries?.some((e: Entry) => e.id === entryId)
);
if (isLoading || collections.length === 0) return null;
return (
<>
<Separator />
<div className="space-y-3">
<h3 className="text-lg font-semibold">In Collections</h3>
<ScrollArea className="w-full">
<div className="flex gap-4 pb-4">
{collections.map((col: Collection) => (
<Link
key={col.id}
to={`/collections/${col.id}`}
className="group shrink-0 w-56 overflow-hidden rounded-lg relative block"
>
<div className="aspect-video w-full overflow-hidden bg-muted rounded-lg">
<img
src={getCollectionBackdropUrl(col)}
alt={col.name}
className="h-full w-full object-cover transition-transform group-hover:scale-105"
/>
</div>
<div className="absolute inset-0 bg-linear-to-t from-black/70 via-black/20 to-transparent rounded-lg" />
<div className="absolute bottom-0 left-0 right-0 p-3">
<p className="text-sm font-medium text-white line-clamp-2 leading-tight">
{col.name}
</p>
{col.entries && (
<p className="text-xs text-white/70 mt-0.5">
{col.entries.length} {col.entries.length === 1 ? 'title' : 'titles'}
</p>
)}
</div>
</Link>
))}
</div>
<ScrollBar orientation="horizontal" />
</ScrollArea>
</div>
</>
);
}
function EntryDetailsSkeleton() {
return (
<div className="space-y-8">
<div className="flex gap-6">
<Skeleton className="h-72 w-48 shrink-0 rounded-lg" />
<div className="flex-1 space-y-4">
<div>
<div className="h-52 -mx-6 -mt-6 bg-muted animate-pulse" />
<div className="max-w-4xl mx-auto flex gap-8 -mt-24">
<Skeleton className="h-64 w-44 shrink-0 rounded-xl" />
<div className="flex-1 space-y-4 pt-24">
<Skeleton className="h-8 w-64" />
<Skeleton className="h-4 w-40" />
<Skeleton className="h-4 w-32" />
<Skeleton className="h-4 w-80" />
<div className="flex gap-2">
<Skeleton className="h-8 w-24" />
<Skeleton className="h-8 w-32" />
<Skeleton className="h-6 w-16" />
<Skeleton className="h-6 w-12" />
</div>
</div>
</div>