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
@@ -0,0 +1,81 @@
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Star } from 'lucide-react';
|
||||
import { useUpdateEntryRatings } from '@/hooks/useEntries';
|
||||
import type { Entry } from '@/types';
|
||||
|
||||
interface RatingDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
entry: Entry;
|
||||
}
|
||||
|
||||
export function RatingDialog({ open, onOpenChange, entry }: RatingDialogProps) {
|
||||
const currentRating = entry.entryRatings?.user_rating ?? 0;
|
||||
const [hovered, setHovered] = useState<number | null>(null);
|
||||
const [selected, setSelected] = useState<number>(currentRating);
|
||||
const updateRatings = useUpdateEntryRatings();
|
||||
|
||||
const displayRating = hovered ?? selected;
|
||||
|
||||
const handleRate = (rating: number) => {
|
||||
setSelected(rating);
|
||||
updateRatings.mutate({
|
||||
id: entry.id,
|
||||
ratings: {
|
||||
id: entry.entryRatings?.id,
|
||||
user_rating: rating || null,
|
||||
},
|
||||
});
|
||||
onOpenChange(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="w-auto sm:max-w-none">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Rate</DialogTitle>
|
||||
<p className="text-sm text-muted-foreground line-clamp-1">{entry.title}</p>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex flex-col items-center gap-4 py-2">
|
||||
<div className="flex gap-1.5">
|
||||
{Array.from({ length: 10 }, (_, i) => i + 1).map((star) => (
|
||||
<button
|
||||
key={star}
|
||||
className="transition-transform hover:scale-125 focus:outline-none"
|
||||
onMouseEnter={() => setHovered(star)}
|
||||
onMouseLeave={() => setHovered(null)}
|
||||
onClick={() => handleRate(star)}
|
||||
>
|
||||
<Star
|
||||
className={`h-8 w-8 transition-colors ${
|
||||
star <= displayRating
|
||||
? 'fill-yellow-400 text-yellow-400'
|
||||
: 'text-muted-foreground/30'
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<p className="text-xl font-semibold tabular-nums">
|
||||
{displayRating > 0 ? `${displayRating} / 10` : '—'}
|
||||
</p>
|
||||
|
||||
{selected > 0 && (
|
||||
<Button variant="ghost" size="sm" onClick={() => handleRate(0)}>
|
||||
Clear rating
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user