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

+128 -73
View File
@@ -1,10 +1,12 @@
import { useState, useMemo } from 'react';
import { Link } from 'react-router-dom';
import { format, startOfMonth, endOfMonth, eachDayOfInterval, getDay, addMonths, subMonths, isSameDay } from 'date-fns';
import { ChevronLeft, ChevronRight } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { useEpisodesByMonth } from '@/hooks/useEpisodes';
import { getTmdbPosterUrl } from '@/lib/media-utils';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { getTmdbPosterUrl, getPosterUrl } from '@/lib/media-utils';
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '@/components/ui/tooltip';
import type { Episode } from '@/types';
const DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
@@ -35,8 +37,8 @@ export function CalendarPage() {
}, [episodes]);
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<div className="flex flex-col h-[calc(100vh-7rem)]">
<div className="flex items-center justify-between mb-4 shrink-0">
<h1 className="text-2xl font-bold">Calendar</h1>
<div className="flex items-center gap-2">
<Button
@@ -46,7 +48,7 @@ export function CalendarPage() {
>
<ChevronLeft className="h-4 w-4" />
</Button>
<span className="min-w-[140px] text-center font-medium">
<span className="min-w-35 text-center font-medium">
{format(currentDate, 'MMMM yyyy')}
</span>
<Button
@@ -59,81 +61,134 @@ export function CalendarPage() {
</div>
</div>
{/* Calendar Grid */}
<div className="rounded-lg border border-border overflow-hidden">
{/* Day headers */}
<div className="grid grid-cols-7 bg-muted/50">
{DAYS.map((day) => (
<div key={day} className="px-2 py-2 text-center text-xs font-medium text-muted-foreground">
{day}
</div>
))}
</div>
{/* Calendar Grid — fills remaining height */}
<TooltipProvider>
<div className="flex flex-col flex-1 rounded-lg border border-border overflow-hidden min-h-0">
{/* Day headers */}
<div className="grid grid-cols-7 bg-muted/50 shrink-0">
{DAYS.map((day) => (
<div key={day} className="px-2 py-2 text-center text-xs font-medium text-muted-foreground">
{day}
</div>
))}
</div>
{/* Day cells */}
<div className="grid grid-cols-7">
{/* Empty cells for offset */}
{Array.from({ length: startDayOfWeek }).map((_, i) => (
<div key={`empty-${i}`} className="min-h-24 border-t border-r border-border bg-muted/20" />
))}
{/* Day cells */}
<div className="grid grid-cols-7 flex-1 overflow-y-auto">
{/* Empty cells for offset */}
{Array.from({ length: startDayOfWeek }).map((_, i) => (
<div key={`empty-${i}`} className="border-t border-r border-border bg-muted/20" />
))}
{days.map((day) => {
const key = format(day, 'yyyy-MM-dd');
const dayEpisodes = episodesByDate.get(key) || [];
const isToday = isSameDay(day, new Date());
{days.map((day) => {
const key = format(day, 'yyyy-MM-dd');
const dayEpisodes = episodesByDate.get(key) || [];
const isToday = isSameDay(day, new Date());
return (
<div
key={key}
className={`min-h-24 border-t border-r border-border p-1 ${
isToday ? 'bg-primary/5' : ''
}`}
>
<span
className={`inline-flex h-6 w-6 items-center justify-center rounded-full text-xs ${
isToday
? 'bg-primary text-primary-foreground font-bold'
: 'text-muted-foreground'
return (
<div
key={key}
className={`border-t border-r border-border p-1.5 ${
isToday ? 'bg-primary/5' : ''
}`}
>
{format(day, 'd')}
</span>
<div className="mt-1 space-y-0.5">
{dayEpisodes.slice(0, 3).map((ep) => (
<Tooltip key={ep.id}>
<TooltipTrigger asChild>
<div className="flex items-center gap-1 rounded bg-accent/50 px-1 py-0.5">
{ep.still_path && (
<img
src={getTmdbPosterUrl(ep.still_path, 'w92')}
alt=""
className="h-4 w-6 rounded object-cover"
/>
)}
<span className="text-[10px] truncate">
S{ep.season_id} E{ep.episode_number}
</span>
</div>
</TooltipTrigger>
<TooltipContent>
<p className="text-xs font-medium">{ep.name}</p>
<p className="text-xs text-muted-foreground">
Episode {ep.episode_number}
</p>
</TooltipContent>
</Tooltip>
))}
{dayEpisodes.length > 3 && (
<span className="text-[10px] text-muted-foreground pl-1">
+{dayEpisodes.length - 3} more
</span>
)}
<span
className={`inline-flex h-6 w-6 items-center justify-center rounded-full text-xs mb-1 ${
isToday
? 'bg-primary text-primary-foreground font-bold'
: 'text-muted-foreground'
}`}
>
{format(day, 'd')}
</span>
<div className="space-y-1">
{dayEpisodes.slice(0, 4).map((ep) => (
<EpisodeCalendarItem key={ep.id} episode={ep} />
))}
{dayEpisodes.length > 4 && (
<span className="text-[10px] text-muted-foreground pl-1">
+{dayEpisodes.length - 4} more
</span>
)}
</div>
</div>
</div>
);
})}
);
})}
</div>
</div>
</div>
</TooltipProvider>
</div>
);
}
function EpisodeCalendarItem({ episode }: { episode: Episode }) {
type EpisodeWithEntry = Episode & {
entry?: {
id: number;
title?: string;
poster_path?: string | null;
medias?: unknown[];
isInLibrary?: boolean;
};
};
const ep = episode as EpisodeWithEntry;
const entry = ep.entry;
const entryId = entry?.id;
const entryTitle = entry?.title ?? '';
const seasonId = episode.season_id;
const posterSrc = episode.still_path
? getTmdbPosterUrl(episode.still_path, 'w92')
: entry
? getPosterUrl({ ...(entry as Parameters<typeof getPosterUrl>[0]), isInLibrary: false })
: undefined;
const seasonLabel = `S${String(seasonId).padStart(2, '0')}`;
const episodeLabel = `E${String(episode.episode_number).padStart(2, '0')}`;
const content = (
<div className="flex items-center gap-1.5 rounded bg-accent/60 hover:bg-accent px-1 py-1 transition-colors cursor-pointer">
{posterSrc && (
<img
src={posterSrc}
alt=""
className="h-10 w-7 rounded object-cover shrink-0"
/>
)}
<div className="min-w-0">
<p className="text-[10px] font-medium truncate leading-tight">
{entryTitle}
</p>
<p className="text-[9px] text-muted-foreground tabular-nums">
{seasonLabel} {episodeLabel}
</p>
</div>
</div>
);
return (
<Tooltip>
<TooltipTrigger asChild>
{entryId ? (
<Link
to={`/entry/${entryId}/season/${seasonId}/episode/${episode.id}`}
className="block"
>
{content}
</Link>
) : (
<div>{content}</div>
)}
</TooltipTrigger>
<TooltipContent side="right" className="max-w-50">
<p className="text-xs font-semibold">{entryTitle}</p>
{episode.name && (
<p className="text-xs">{episode.name}</p>
)}
<p className="text-xs text-muted-foreground">
{seasonLabel} {episodeLabel}
</p>
</TooltipContent>
</Tooltip>
);
}