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,5 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { useParams, Link } from 'react-router-dom';
|
||||
import { useParams, Link, useNavigate } from 'react-router-dom';
|
||||
import { useEntry, useEntrySeasons, useRefreshEntry } from '@/hooks/useEntries';
|
||||
import { useEntrySeenByEntry, useDeleteEntrySeen } from '@/hooks/useEntrySeen';
|
||||
import { useCollections } from '@/hooks/useCollections';
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import {
|
||||
@@ -24,8 +25,9 @@ import {
|
||||
ImageIcon,
|
||||
Settings,
|
||||
Star,
|
||||
Loader2,
|
||||
History,
|
||||
Trash2,
|
||||
ExternalLink,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
Tooltip,
|
||||
@@ -35,13 +37,14 @@ import {
|
||||
} from '@/components/ui/tooltip';
|
||||
import { CastList } from '@/components/entries/CastList';
|
||||
import { SeasonsContainer } from '@/components/entries/SeasonsContainer';
|
||||
import { EpisodeWatchHistory } from '@/components/entries/EpisodeWatchHistory';
|
||||
// EpisodeWatchHistory is available for future use
|
||||
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 { MovieWatchHistoryDialog } from '@/components/dialogs/MovieWatchHistoryDialog';
|
||||
import { ConfirmDialog } from '@/components/dialogs/ConfirmDialog';
|
||||
import { EntryDetailsSkeleton } from '@/components/skeletons/PageSkeletons';
|
||||
import {
|
||||
getPosterUrl,
|
||||
@@ -51,18 +54,20 @@ import {
|
||||
formatRuntime,
|
||||
formatDate,
|
||||
} from '@/lib/media-utils';
|
||||
import { useUpdateEntry } from '@/hooks/useEntries';
|
||||
import { useUpdateEntry, useDeleteEntry } from '@/hooks/useEntries';
|
||||
import type { Collection, Entry } from '@/types';
|
||||
|
||||
export function EntryDetailsPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const entryId = parseInt(id!, 10);
|
||||
const navigate = useNavigate();
|
||||
const { data: entry, isLoading } = useEntry(entryId);
|
||||
const { data: seasons } = useEntrySeasons(entryId);
|
||||
const { data: watchHistory = [] } = useEntrySeenByEntry(entryId);
|
||||
const updateEntry = useUpdateEntry();
|
||||
const refreshEntry = useRefreshEntry();
|
||||
const deleteEntrySeen = useDeleteEntrySeen();
|
||||
const deleteEntry = useDeleteEntry();
|
||||
|
||||
// Merge library entry with detail entry so we get both library flags AND full details (credits, etc.)
|
||||
const libraryEntry = useLibraryStore((s) => s.entries.get(entryId));
|
||||
@@ -76,6 +81,7 @@ export function EntryDetailsPage() {
|
||||
const [showCollectionDialog, setShowCollectionDialog] = useState(false);
|
||||
const [showRatingDialog, setShowRatingDialog] = useState(false);
|
||||
const [showWatchHistoryDialog, setShowWatchHistoryDialog] = useState(false);
|
||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||
|
||||
if (isLoading || !displayEntry) {
|
||||
return <EntryDetailsSkeleton />;
|
||||
@@ -112,41 +118,6 @@ export function EntryDetailsPage() {
|
||||
<div className="mx-auto max-w-4xl">
|
||||
{/* Action buttons — top right */}
|
||||
<div className="flex justify-end gap-1 -mt-10 relative z-10 mb-2">
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant={e.favorit ? 'default' : 'outline'}
|
||||
size="icon"
|
||||
className="h-9 w-9"
|
||||
onClick={toggleFavorite}
|
||||
disabled={updateEntry.isPending}
|
||||
>
|
||||
{updateEntry.isPending ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<Heart className={`h-4 w-4 ${e.favorit ? 'fill-current' : ''}`} />
|
||||
)}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{e.favorit ? 'Unfavorite' : 'Favorite'}</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="h-9 w-9"
|
||||
onClick={() => setShowSeenDialog(true)}
|
||||
>
|
||||
<Eye className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Mark Watched</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="h-9 w-9">
|
||||
@@ -154,6 +125,11 @@ export function EntryDetailsPage() {
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-56">
|
||||
{/* Watch & Rate */}
|
||||
<DropdownMenuItem onClick={() => setShowSeenDialog(true)}>
|
||||
<Eye className="mr-2 h-4 w-4" />
|
||||
Mark as watched
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setShowRatingDialog(true)}>
|
||||
<Star className="mr-2 h-4 w-4" />
|
||||
Rate this
|
||||
@@ -164,6 +140,16 @@ export function EntryDetailsPage() {
|
||||
Watch History
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuSeparator />
|
||||
{/* Organize */}
|
||||
<DropdownMenuItem onClick={toggleFavorite} disabled={updateEntry.isPending}>
|
||||
<Heart className={`mr-2 h-4 w-4 ${e.favorit ? 'fill-current' : ''}`} />
|
||||
{e.favorit ? 'Unfavorite' : 'Favorite'}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setShowCollectionDialog(true)}>
|
||||
<FolderPlus className="mr-2 h-4 w-4" />
|
||||
Add to collection
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
updateEntry.mutate({ id: e.id, data: { hidden: !e.hidden } })
|
||||
@@ -172,14 +158,12 @@ export function EntryDetailsPage() {
|
||||
<EyeOff className="mr-2 h-4 w-4" />
|
||||
{e.hidden ? 'Unhide' : 'Hide'}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
{/* Manage */}
|
||||
<DropdownMenuItem onClick={() => refreshEntry.mutate(e.id)} disabled={refreshEntry.isPending}>
|
||||
<RefreshCw className={`mr-2 h-4 w-4 ${refreshEntry.isPending ? 'animate-spin' : ''}`} />
|
||||
{refreshEntry.isPending ? 'Refreshing...' : '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
|
||||
@@ -188,6 +172,15 @@ export function EntryDetailsPage() {
|
||||
<Settings className="mr-2 h-4 w-4" />
|
||||
Settings
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
{/* Danger */}
|
||||
<DropdownMenuItem
|
||||
className="text-destructive focus:text-destructive"
|
||||
onClick={() => setShowDeleteConfirm(true)}
|
||||
>
|
||||
<Trash2 className="mr-2 h-4 w-4" />
|
||||
Delete entry
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
@@ -196,25 +189,52 @@ export function EntryDetailsPage() {
|
||||
<div className="flex flex-col gap-6 relative items-start sm:flex-row sm:gap-8 sm:-mt-8">
|
||||
{/* LEFT: Sticky poster */}
|
||||
<div className="sm:sticky sm:top-20 w-32 sm:w-44 shrink-0 self-start mx-auto sm:mx-0">
|
||||
<img
|
||||
src={poster}
|
||||
alt={e.title}
|
||||
className="w-full aspect-2/3 rounded-xl object-cover shadow-2xl ring-1 ring-border/50"
|
||||
/>
|
||||
<div className="relative">
|
||||
{e.favorit && (
|
||||
<div className="absolute top-2 left-2 z-10 rounded-full bg-background/80 p-1 backdrop-blur-sm">
|
||||
<Heart className="h-4 w-4 fill-red-500 text-red-500" />
|
||||
</div>
|
||||
)}
|
||||
<img
|
||||
src={poster}
|
||||
alt={e.title}
|
||||
className="w-full aspect-2/3 rounded-xl object-cover shadow-2xl ring-1 ring-border/50"
|
||||
/>
|
||||
</div>
|
||||
{/* External links */}
|
||||
{e.entryIds && (
|
||||
<div className="flex items-center justify-center gap-3 mt-3">
|
||||
{e.entryIds.tmdb_id && (
|
||||
<a
|
||||
href={`https://www.themoviedb.org/${e.is_tvseries ? 'tv' : 'movie'}/${e.entryIds.tmdb_id}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
TMDB
|
||||
</a>
|
||||
)}
|
||||
{e.entryIds.imdb_id && (
|
||||
<a
|
||||
href={`https://www.imdb.com/title/${e.entryIds.imdb_id}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
IMDb
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* RIGHT: Entry info */}
|
||||
<div className="flex-1 min-w-0 space-y-4">
|
||||
{/* Title + status + director */}
|
||||
{/* Title + 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>
|
||||
<h1 className="text-3xl font-bold leading-tight">{e.title}</h1>
|
||||
{director?.people?.name && (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
by{' '}
|
||||
@@ -244,6 +264,12 @@ export function EntryDetailsPage() {
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
{e.is_tvseries && e.status && (
|
||||
<>
|
||||
<span>•</span>
|
||||
<span>{e.status}</span>
|
||||
</>
|
||||
)}
|
||||
{e.runtime && !e.is_tvseries && (
|
||||
<>
|
||||
<span>•</span>
|
||||
@@ -275,15 +301,29 @@ export function EntryDetailsPage() {
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{!e.is_tvseries && watchHistory.length === 0 && (
|
||||
<>
|
||||
<span>•</span>
|
||||
<button
|
||||
className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors underline decoration-dotted"
|
||||
onClick={() => setShowSeenDialog(true)}
|
||||
>
|
||||
<Eye className="h-3 w-3" />
|
||||
Mark as watched
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Genres */}
|
||||
{e.genres && e.genres.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{e.genres.map((g) => (
|
||||
<Badge key={g.id} variant="outline" className="text-xs">
|
||||
{g.name}
|
||||
</Badge>
|
||||
<Link key={g.id} to={`/library?genre=${encodeURIComponent(g.name)}`}>
|
||||
<Badge variant="outline" className="text-xs cursor-pointer hover:bg-accent transition-colors">
|
||||
{g.name}
|
||||
</Badge>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
@@ -417,6 +457,20 @@ export function EntryDetailsPage() {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<ConfirmDialog
|
||||
open={showDeleteConfirm}
|
||||
onOpenChange={setShowDeleteConfirm}
|
||||
title="Delete Entry"
|
||||
description={`Are you sure you want to delete "${e.title}" from your library? This action cannot be undone.`}
|
||||
confirmLabel="Delete"
|
||||
variant="destructive"
|
||||
onConfirm={() => {
|
||||
deleteEntry.mutate(e.id, {
|
||||
onSuccess: () => navigate('/library'),
|
||||
});
|
||||
setShowDeleteConfirm(false);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user