feat: entry details overhaul, navigation, rating half-stars, library growth "all", accuracy field
- SeasonPage: add back navigation link to entry details page - EpisodePage: add breadcrumb navigation back to entry and season pages - EntryCard: non-library entries now open a details dialog on click with overview, rating, and add-to-library button - EntryDetailsPage: move favorite and mark-watched buttons into grouped dropdown menu with separators - EntryDetailsPage: add favorite badge (heart icon) on top-left of poster - EntryDetailsPage: add "mark as watched" clickable text next to runtime for unwatched movies - EntryDetailsPage: genre pills are now clickable links that navigate to library page with genre filter - EntryDetailsPage: hide status pill for movies; show status as text next to release date for TV series - EntryDetailsPage: add delete entry option in dropdown menu with confirmation dialog and redirect to library - EntryDetailsPage: add TMDB and IMDb external links under poster using entry.entryIds - EntryDetailsPage: group all dropdown actions by relevance (Watch/Rate, Organize, Manage, Danger) with separators - RatingDialog: support half-star ratings (0.5 increments) with left/right click zones per star - RatingDialog: fix clear rating button by syncing state on dialog open and using dedicated handleClear function - LibraryGrowthChart: add "All" option to year selector (default) showing cumulative growth across all years - Frontend: add SeenAccuracy type to types/index.ts, update API layers and hooks to support accuracy - EntrySeenDialog: add Date Accuracy selector (Exact/Estimated/Unknown) with EXACT default - EpisodeSeenEditDialog: add Date Accuracy selector, updated overrideSubmit signature - SeasonPage: pass accuracy through bulk mark-all-watched flow
This commit is contained in:
1 parent
ebdef6ba6c
commit
63fdc00ac2
15 files changed
+396
-109
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -22,6 +22,13 @@ export function RatingDialog({ open, onOpenChange, entry }: RatingDialogProps) {
|
||||
const [selected, setSelected] = useState<number>(currentRating);
|
||||
const updateRatings = useUpdateEntryRatings();
|
||||
|
||||
// Sync selected when dialog opens or entry rating changes
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setSelected(entry.entryRatings?.user_rating ?? 0);
|
||||
}
|
||||
}, [open, entry.entryRatings?.user_rating]);
|
||||
|
||||
const displayRating = hovered ?? selected;
|
||||
|
||||
const handleRate = (rating: number) => {
|
||||
@@ -36,6 +43,18 @@ export function RatingDialog({ open, onOpenChange, entry }: RatingDialogProps) {
|
||||
onOpenChange(false);
|
||||
};
|
||||
|
||||
const handleClear = () => {
|
||||
setSelected(0);
|
||||
updateRatings.mutate({
|
||||
id: entry.id,
|
||||
ratings: {
|
||||
id: entry.entryRatings?.id,
|
||||
user_rating: null,
|
||||
},
|
||||
});
|
||||
onOpenChange(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="w-auto sm:max-w-none">
|
||||
@@ -45,32 +64,51 @@ export function RatingDialog({ open, onOpenChange, entry }: RatingDialogProps) {
|
||||
</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 className="flex gap-0.5">
|
||||
{Array.from({ length: 10 }, (_, i) => i + 1).map((star) => {
|
||||
const halfValue = star - 0.5;
|
||||
return (
|
||||
<div key={star} className="relative h-8 w-8">
|
||||
{/* Left half — half star */}
|
||||
<button
|
||||
className="absolute inset-y-0 left-0 w-1/2 z-10 focus:outline-none"
|
||||
onMouseEnter={() => setHovered(halfValue)}
|
||||
onMouseLeave={() => setHovered(null)}
|
||||
onClick={() => handleRate(halfValue)}
|
||||
/>
|
||||
{/* Right half — full star */}
|
||||
<button
|
||||
className="absolute inset-y-0 right-0 w-1/2 z-10 focus:outline-none"
|
||||
onMouseEnter={() => setHovered(star)}
|
||||
onMouseLeave={() => setHovered(null)}
|
||||
onClick={() => handleRate(star)}
|
||||
/>
|
||||
{/* Star icon */}
|
||||
<div className="pointer-events-none transition-transform hover:scale-125">
|
||||
{displayRating >= star ? (
|
||||
<Star className="h-8 w-8 fill-yellow-400 text-yellow-400 transition-colors" />
|
||||
) : displayRating >= halfValue ? (
|
||||
<div className="relative h-8 w-8">
|
||||
<Star className="absolute h-8 w-8 text-muted-foreground/30 transition-colors" />
|
||||
<div className="absolute inset-0 overflow-hidden w-1/2">
|
||||
<Star className="h-8 w-8 fill-yellow-400 text-yellow-400 transition-colors" />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Star className="h-8 w-8 text-muted-foreground/30 transition-colors" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<p className="text-xl font-semibold tabular-nums">
|
||||
{displayRating > 0 ? `${displayRating} / 10` : '—'}
|
||||
</p>
|
||||
|
||||
{selected > 0 && (
|
||||
<Button variant="ghost" size="sm" onClick={() => handleRate(0)}>
|
||||
{(selected > 0 || currentRating > 0) && (
|
||||
<Button variant="ghost" size="sm" onClick={handleClear}>
|
||||
Clear rating
|
||||
</Button>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user