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:
1 parent
11eab03987
commit
3ca24434d7
16 files changed
+857
-322
No files matched your search
@@ -1,18 +1,24 @@
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { usePerson } from '@/hooks/usePeople';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { peopleApi } from '@/api/people';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { usePerson, usePersonTmdbFilmography } from '@/hooks/usePeople';
|
||||
import { useLibrary } from '@/hooks/useEntries';
|
||||
import { useLibraryStore } from '@/stores/useLibraryStore';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { EntryCard } from '@/components/entries/EntryCard';
|
||||
import { getProfileUrl, formatDate } from '@/lib/media-utils';
|
||||
import { getTmdbImageUrl } from '@/lib/api';
|
||||
import type { TmdbFilmographyItem } from '@/api/people';
|
||||
|
||||
export function PersonDetailsPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const personId = parseInt(id!, 10);
|
||||
const { data: person, isLoading } = usePerson(personId);
|
||||
const { data: tmdbFilmography, isLoading: tmdbLoading } = usePersonTmdbFilmography(personId);
|
||||
useLibrary();
|
||||
const libraryMap = useLibraryStore((s) => s.entries);
|
||||
const libraryLoaded = useLibraryStore((s) => s.isLoaded);
|
||||
|
||||
if (isLoading || !person) {
|
||||
return (
|
||||
@@ -31,47 +37,21 @@ export function PersonDetailsPage() {
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
{/* Profile header */}
|
||||
<div className="flex gap-8">
|
||||
<Avatar className="h-48 w-48 shrink-0">
|
||||
<AvatarImage
|
||||
src={getProfileUrl(person.profile_path)}
|
||||
alt={person.name}
|
||||
/>
|
||||
<AvatarImage src={getProfileUrl(person.profile_path)} alt={person.name} />
|
||||
<AvatarFallback className="text-3xl">
|
||||
{person.name
|
||||
.split(' ')
|
||||
.map((n: string) => n[0])
|
||||
.join('')}
|
||||
{person.name.split(' ').map((n: string) => n[0]).join('')}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
<div className="space-y-3">
|
||||
<h1 className="text-3xl font-bold">{person.name}</h1>
|
||||
<div className="flex flex-wrap items-center gap-3 text-sm text-muted-foreground">
|
||||
{person.known_for_department && (
|
||||
<span>{person.known_for_department}</span>
|
||||
)}
|
||||
{person.birthday && (
|
||||
<>
|
||||
<span>•</span>
|
||||
<span>Born: {formatDate(person.birthday)}</span>
|
||||
</>
|
||||
)}
|
||||
{person.deathday && (
|
||||
<>
|
||||
<span>•</span>
|
||||
<span>Died: {formatDate(person.deathday)}</span>
|
||||
</>
|
||||
)}
|
||||
{person.place_of_birth && (
|
||||
<>
|
||||
<span>•</span>
|
||||
<span>{person.place_of_birth}</span>
|
||||
</>
|
||||
)}
|
||||
{person.known_for_department && <span>{person.known_for_department}</span>}
|
||||
{person.birthday && (<><span>•</span><span>Born: {formatDate(person.birthday)}</span></>)}
|
||||
{person.deathday && (<><span>•</span><span>Died: {formatDate(person.deathday)}</span></>)}
|
||||
{person.place_of_birth && (<><span>•</span><span>{person.place_of_birth}</span></>)}
|
||||
</div>
|
||||
|
||||
{person.biography && (
|
||||
<p className="text-sm text-muted-foreground leading-relaxed max-w-2xl line-clamp-6">
|
||||
{person.biography}
|
||||
@@ -82,13 +62,118 @@ export function PersonDetailsPage() {
|
||||
|
||||
<Separator />
|
||||
|
||||
{/* Filmography placeholder */}
|
||||
<FilmographySection
|
||||
libraryMap={libraryMap}
|
||||
libraryLoaded={libraryLoaded}
|
||||
tmdbFilmography={tmdbFilmography}
|
||||
tmdbLoading={tmdbLoading}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface FilmographySectionProps {
|
||||
libraryMap: Map<number, import('@/types').Entry>;
|
||||
libraryLoaded: boolean;
|
||||
tmdbFilmography?: { cast: TmdbFilmographyItem[]; crew: TmdbFilmographyItem[] };
|
||||
tmdbLoading: boolean;
|
||||
}
|
||||
|
||||
function FilmographySection({ libraryMap, libraryLoaded, tmdbFilmography, tmdbLoading }: FilmographySectionProps) {
|
||||
if (tmdbLoading || !libraryLoaded) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h2 className="text-xl font-semibold">Filmography</h2>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Filmography details will be loaded from credits associated with this person.
|
||||
</p>
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5">
|
||||
{Array.from({ length: 10 }).map((_, i) => (
|
||||
<Skeleton key={i} className="aspect-2/3 rounded-lg" />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const allTmdbCredits = [
|
||||
...(tmdbFilmography?.cast ?? []),
|
||||
...(tmdbFilmography?.crew?.filter((c) => c.job === 'Director' || c.department === 'Directing') ?? []),
|
||||
];
|
||||
const seenTmdbIds = new Set<number>();
|
||||
const dedupedCredits = allTmdbCredits.filter((c) => {
|
||||
if (seenTmdbIds.has(c.id)) return false;
|
||||
seenTmdbIds.add(c.id);
|
||||
return true;
|
||||
});
|
||||
|
||||
const tmdbIdToLibraryEntry = new Map<number, import('@/types').Entry>();
|
||||
for (const entry of libraryMap.values()) {
|
||||
if (entry.entryIds?.tmdb_id != null) {
|
||||
tmdbIdToLibraryEntry.set(Number(entry.entryIds.tmdb_id), entry);
|
||||
}
|
||||
}
|
||||
|
||||
const libraryCredits = dedupedCredits.filter((c) => tmdbIdToLibraryEntry.has(c.id));
|
||||
const otherCredits = dedupedCredits.filter((c) => !tmdbIdToLibraryEntry.has(c.id));
|
||||
|
||||
if (dedupedCredits.length === 0) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h2 className="text-xl font-semibold">Filmography</h2>
|
||||
<p className="text-sm text-muted-foreground">No filmography found.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<h2 className="text-xl font-semibold">Filmography</h2>
|
||||
|
||||
{libraryCredits.length > 0 && (
|
||||
<div className="space-y-3">
|
||||
<h3 className="text-sm font-medium text-muted-foreground uppercase tracking-wide">In Your Library</h3>
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5">
|
||||
{libraryCredits.map((credit) => {
|
||||
const entry = tmdbIdToLibraryEntry.get(credit.id)!;
|
||||
return (
|
||||
<div key={credit.id} className="space-y-1">
|
||||
<EntryCard entry={entry} />
|
||||
{credit.character && (
|
||||
<p className="text-xs text-muted-foreground text-center line-clamp-1 px-1">{credit.character}</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{otherCredits.length > 0 && (
|
||||
<div className="space-y-3">
|
||||
<h3 className="text-sm font-medium text-muted-foreground uppercase tracking-wide">Not in Library</h3>
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5">
|
||||
{otherCredits.map((credit) => {
|
||||
const title = credit.title ?? credit.name ?? 'Unknown';
|
||||
const posterSrc = credit.poster_path
|
||||
? getTmdbImageUrl(credit.poster_path, 'w342')
|
||||
: '/images/default-poster.png';
|
||||
return (
|
||||
<div key={credit.id} className="space-y-1">
|
||||
<div className="relative aspect-2/3 overflow-hidden rounded-lg bg-muted">
|
||||
<img src={posterSrc} alt={title} className="h-full w-full object-cover" />
|
||||
<div className="absolute inset-0 bg-linear-to-t from-black/60 to-transparent" />
|
||||
<p className="absolute bottom-0 left-0 right-0 p-2 text-xs font-medium text-white line-clamp-2">{title}</p>
|
||||
<Badge variant="secondary" className="absolute top-1.5 right-1.5 text-[9px] px-1 py-0">
|
||||
{credit.media_type === 'tv' ? 'TV' : 'Movie'}
|
||||
</Badge>
|
||||
</div>
|
||||
{credit.character && (
|
||||
<p className="text-xs text-muted-foreground text-center line-clamp-1 px-1">{credit.character}</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user