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
13 files changed
+394
-107
No files matched your search
@@ -16,7 +16,7 @@ export const entrySeenApi = {
|
|||||||
throw err;
|
throw err;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
create: (data: { entry_id: number; date_seen: string; seen_with?: string }) =>
|
create: (data: { entry_id: number; date_seen: string; seen_with?: string; accuracy?: string }) =>
|
||||||
api.post<EntrySeen>('/entry-seen', data).then((r) => r.data),
|
api.post<EntrySeen>('/entry-seen', data).then((r) => r.data),
|
||||||
|
|
||||||
update: (id: number, data: Partial<EntrySeen>) =>
|
update: (id: number, data: Partial<EntrySeen>) =>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export const episodeSeenApi = {
|
|||||||
episode_id: number;
|
episode_id: number;
|
||||||
date_seen: string;
|
date_seen: string;
|
||||||
seen_with?: string;
|
seen_with?: string;
|
||||||
|
accuracy?: string;
|
||||||
}) => api.post<EpisodeSeen>('/episode-seen', data).then((r) => r.data),
|
}) => api.post<EpisodeSeen>('/episode-seen', data).then((r) => r.data),
|
||||||
|
|
||||||
update: (id: number, data: Partial<EpisodeSeen>) =>
|
update: (id: number, data: Partial<EpisodeSeen>) =>
|
||||||
|
|||||||
@@ -56,13 +56,50 @@ export function LibraryGrowthChart() {
|
|||||||
return Array.from(set).sort((a, b) => b - a);
|
return Array.from(set).sort((a, b) => b - a);
|
||||||
}, [allEntries, currentYear]);
|
}, [allEntries, currentYear]);
|
||||||
|
|
||||||
const [year, setYear] = useState(currentYear);
|
const [year, setYear] = useState<number | 'all'>('all');
|
||||||
|
|
||||||
// Ensure selected year is always within the available years
|
// Ensure selected year is always valid
|
||||||
const effectiveYear = years.includes(year) ? year : years[0];
|
const effectiveYear = year === 'all' ? 'all' : (years.includes(year) ? year : years[0]);
|
||||||
|
|
||||||
const chartData = useMemo(() => {
|
const chartData = useMemo(() => {
|
||||||
const library = allEntries.filter((e) => !e.watchlist);
|
const library = allEntries.filter((e) => !e.watchlist);
|
||||||
|
|
||||||
|
if (effectiveYear === 'all') {
|
||||||
|
// Build monthly data across all years
|
||||||
|
const dateEntries = library
|
||||||
|
.map((e) => {
|
||||||
|
const d = getEntryDate(e);
|
||||||
|
return d ? new Date(d) : null;
|
||||||
|
})
|
||||||
|
.filter(Boolean) as Date[];
|
||||||
|
|
||||||
|
if (dateEntries.length === 0) {
|
||||||
|
return MONTH_LABELS.map((label) => ({ month: label, count: 0, cumulative: 0 }));
|
||||||
|
}
|
||||||
|
|
||||||
|
const minYear = Math.min(...dateEntries.map((d) => d.getFullYear()));
|
||||||
|
const maxYear = Math.max(...dateEntries.map((d) => d.getFullYear()));
|
||||||
|
|
||||||
|
// Build data points for each month across all years
|
||||||
|
const data: { month: string; count: number; cumulative: number }[] = [];
|
||||||
|
let cumulative = 0;
|
||||||
|
|
||||||
|
for (let y = minYear; y <= maxYear; y++) {
|
||||||
|
for (let m = 0; m < 12; m++) {
|
||||||
|
const count = dateEntries.filter(
|
||||||
|
(d) => d.getFullYear() === y && d.getMonth() === m
|
||||||
|
).length;
|
||||||
|
cumulative += count;
|
||||||
|
data.push({
|
||||||
|
month: `${MONTH_LABELS[m]} ${y}`,
|
||||||
|
count,
|
||||||
|
cumulative,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
const beforeYear = library.filter((e) => {
|
const beforeYear = library.filter((e) => {
|
||||||
const d = getEntryDate(e);
|
const d = getEntryDate(e);
|
||||||
return d && new Date(d).getFullYear() < effectiveYear;
|
return d && new Date(d).getFullYear() < effectiveYear;
|
||||||
@@ -97,9 +134,13 @@ export function LibraryGrowthChart() {
|
|||||||
</div>
|
</div>
|
||||||
<select
|
<select
|
||||||
value={effectiveYear}
|
value={effectiveYear}
|
||||||
onChange={(e) => setYear(Number(e.target.value))}
|
onChange={(e) => {
|
||||||
|
const val = e.target.value;
|
||||||
|
setYear(val === 'all' ? 'all' : Number(val));
|
||||||
|
}}
|
||||||
className="rounded-md border border-border bg-card text-foreground text-xs px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"
|
className="rounded-md border border-border bg-card text-foreground text-xs px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"
|
||||||
>
|
>
|
||||||
|
<option value="all">All</option>
|
||||||
{years.map((y) => (
|
{years.map((y) => (
|
||||||
<option key={y} value={y}>{y}</option>
|
<option key={y} value={y}>{y}</option>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -30,18 +30,14 @@ import {
|
|||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { useCreateEntrySeen, useUpdateEntrySeen } from '@/hooks/useEntrySeen';
|
import { useCreateEntrySeen, useUpdateEntrySeen } from '@/hooks/useEntrySeen';
|
||||||
import { useCreateEpisodeSeen } from '@/hooks/useEpisodeSeen';
|
import { useCreateEpisodeSeen } from '@/hooks/useEpisodeSeen';
|
||||||
import type { Entry, Season, EntrySeen } from '@/types';
|
import type { Entry, Season, EntrySeen, SeenAccuracy } from '@/types';
|
||||||
|
|
||||||
const movieSeenSchema = z.object({
|
const seenSchema = z.object({
|
||||||
date_seen: z.string().min(1, 'Date is required'),
|
season_id: z.string().optional(),
|
||||||
seen_with: z.string().optional(),
|
episode_id: z.string().optional(),
|
||||||
});
|
|
||||||
|
|
||||||
const tvSeenSchema = z.object({
|
|
||||||
season_id: z.string().min(1, 'Season is required'),
|
|
||||||
episode_id: z.string().min(1, 'Episode is required'),
|
|
||||||
date_seen: z.string().min(1, 'Date is required'),
|
date_seen: z.string().min(1, 'Date is required'),
|
||||||
seen_with: z.string().optional(),
|
seen_with: z.string().optional(),
|
||||||
|
accuracy: z.enum(['EXACT', 'ESTIMATED', 'UNKNOWN']).default('EXACT'),
|
||||||
});
|
});
|
||||||
|
|
||||||
interface EntrySeenDialogProps {
|
interface EntrySeenDialogProps {
|
||||||
@@ -67,24 +63,27 @@ export function EntrySeenDialog({
|
|||||||
const [selectedSeasonId, setSelectedSeasonId] = useState<string>('');
|
const [selectedSeasonId, setSelectedSeasonId] = useState<string>('');
|
||||||
|
|
||||||
const isTV = entry.is_tvseries;
|
const isTV = entry.is_tvseries;
|
||||||
const schema = isTV ? tvSeenSchema : movieSeenSchema;
|
|
||||||
const seasonList = Array.isArray(seasons) ? seasons : [];
|
const seasonList = Array.isArray(seasons) ? seasons : [];
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
setValue,
|
setValue,
|
||||||
|
watch,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
} = useForm({
|
} = useForm({
|
||||||
resolver: zodResolver(schema),
|
resolver: zodResolver(seenSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
date_seen: editRecord?.date_seen || format(new Date(), 'yyyy-MM-dd'),
|
date_seen: editRecord?.date_seen || format(new Date(), 'yyyy-MM-dd'),
|
||||||
seen_with: editRecord?.seen_with || '',
|
seen_with: editRecord?.seen_with || '',
|
||||||
season_id: '',
|
season_id: '',
|
||||||
episode_id: '',
|
episode_id: '',
|
||||||
|
accuracy: (editRecord?.accuracy || 'EXACT') as SeenAccuracy,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const accuracyValue = watch('accuracy') as SeenAccuracy;
|
||||||
|
|
||||||
const createEntrySeen = useCreateEntrySeen();
|
const createEntrySeen = useCreateEntrySeen();
|
||||||
const updateEntrySeen = useUpdateEntrySeen();
|
const updateEntrySeen = useUpdateEntrySeen();
|
||||||
const createEpisodeSeen = useCreateEpisodeSeen();
|
const createEpisodeSeen = useCreateEpisodeSeen();
|
||||||
@@ -94,6 +93,7 @@ export function EntrySeenDialog({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const onSubmit = (data: Record<string, string | undefined>) => {
|
const onSubmit = (data: Record<string, string | undefined>) => {
|
||||||
|
const acc = (data.accuracy as SeenAccuracy) || 'EXACT';
|
||||||
if (isTV && data.episode_id) {
|
if (isTV && data.episode_id) {
|
||||||
createEpisodeSeen.mutate(
|
createEpisodeSeen.mutate(
|
||||||
{
|
{
|
||||||
@@ -101,6 +101,7 @@ export function EntrySeenDialog({
|
|||||||
episode_id: parseInt(data.episode_id),
|
episode_id: parseInt(data.episode_id),
|
||||||
date_seen: data.date_seen!,
|
date_seen: data.date_seen!,
|
||||||
seen_with: data.seen_with || undefined,
|
seen_with: data.seen_with || undefined,
|
||||||
|
accuracy: acc,
|
||||||
},
|
},
|
||||||
{ onSuccess: () => onOpenChange(false) }
|
{ onSuccess: () => onOpenChange(false) }
|
||||||
);
|
);
|
||||||
@@ -112,6 +113,7 @@ export function EntrySeenDialog({
|
|||||||
entry_id: entry.id,
|
entry_id: entry.id,
|
||||||
date_seen: data.date_seen,
|
date_seen: data.date_seen,
|
||||||
seen_with: data.seen_with || undefined,
|
seen_with: data.seen_with || undefined,
|
||||||
|
accuracy: acc,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ onSuccess: () => onOpenChange(false) }
|
{ onSuccess: () => onOpenChange(false) }
|
||||||
@@ -122,6 +124,7 @@ export function EntrySeenDialog({
|
|||||||
entry_id: entry.id,
|
entry_id: entry.id,
|
||||||
date_seen: data.date_seen!,
|
date_seen: data.date_seen!,
|
||||||
seen_with: data.seen_with || undefined,
|
seen_with: data.seen_with || undefined,
|
||||||
|
accuracy: acc,
|
||||||
},
|
},
|
||||||
{ onSuccess: () => onOpenChange(false) }
|
{ onSuccess: () => onOpenChange(false) }
|
||||||
);
|
);
|
||||||
@@ -234,6 +237,24 @@ export function EntrySeenDialog({
|
|||||||
<Input id="seen_with" {...register('seen_with')} placeholder="e.g. John, Jane" />
|
<Input id="seen_with" {...register('seen_with')} placeholder="e.g. John, Jane" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Accuracy */}
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label>Date Accuracy</Label>
|
||||||
|
<Select
|
||||||
|
value={accuracyValue}
|
||||||
|
onValueChange={(v) => setValue('accuracy', v as SeenAccuracy)}
|
||||||
|
>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="EXACT">Exact</SelectItem>
|
||||||
|
<SelectItem value="ESTIMATED">Estimated</SelectItem>
|
||||||
|
<SelectItem value="UNKNOWN">Unknown</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -9,8 +9,15 @@ import {
|
|||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from '@/components/ui/select';
|
||||||
import { useUpdateEpisodeSeen, useCreateEpisodeSeen } from '@/hooks/useEpisodeSeen';
|
import { useUpdateEpisodeSeen, useCreateEpisodeSeen } from '@/hooks/useEpisodeSeen';
|
||||||
import type { EpisodeSeen } from '@/types';
|
import type { EpisodeSeen, SeenAccuracy } from '@/types';
|
||||||
|
|
||||||
interface EpisodeSeenEditDialogProps {
|
interface EpisodeSeenEditDialogProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -23,7 +30,7 @@ interface EpisodeSeenEditDialogProps {
|
|||||||
seasonId?: number;
|
seasonId?: number;
|
||||||
mode?: 'create' | 'edit';
|
mode?: 'create' | 'edit';
|
||||||
/** If provided, called instead of the normal create/update mutation */
|
/** If provided, called instead of the normal create/update mutation */
|
||||||
overrideSubmit?: (date: string, seenWith: string) => void;
|
overrideSubmit?: (date: string, seenWith: string, accuracy: SeenAccuracy) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function EpisodeSeenEditDialog({
|
export function EpisodeSeenEditDialog({
|
||||||
@@ -39,13 +46,14 @@ export function EpisodeSeenEditDialog({
|
|||||||
const today = new Date().toISOString().split('T')[0];
|
const today = new Date().toISOString().split('T')[0];
|
||||||
const [date, setDate] = useState(record?.date_seen?.split('T')[0] ?? today);
|
const [date, setDate] = useState(record?.date_seen?.split('T')[0] ?? today);
|
||||||
const [seenWith, setSeenWith] = useState(record?.seen_with ?? '');
|
const [seenWith, setSeenWith] = useState(record?.seen_with ?? '');
|
||||||
|
const [accuracy, setAccuracy] = useState<SeenAccuracy>(record?.accuracy ?? 'EXACT');
|
||||||
|
|
||||||
const updateEpisodeSeen = useUpdateEpisodeSeen();
|
const updateEpisodeSeen = useUpdateEpisodeSeen();
|
||||||
const createEpisodeSeen = useCreateEpisodeSeen();
|
const createEpisodeSeen = useCreateEpisodeSeen();
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
if (overrideSubmit) {
|
if (overrideSubmit) {
|
||||||
overrideSubmit(date, seenWith);
|
overrideSubmit(date, seenWith, accuracy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode === 'edit' && record) {
|
if (mode === 'edit' && record) {
|
||||||
@@ -56,6 +64,7 @@ export function EpisodeSeenEditDialog({
|
|||||||
entry_id: entryId,
|
entry_id: entryId,
|
||||||
date_seen: date,
|
date_seen: date,
|
||||||
seen_with: seenWith || null,
|
seen_with: seenWith || null,
|
||||||
|
accuracy,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -66,6 +75,7 @@ export function EpisodeSeenEditDialog({
|
|||||||
episode_id: epId,
|
episode_id: epId,
|
||||||
date_seen: date,
|
date_seen: date,
|
||||||
seen_with: seenWith || undefined,
|
seen_with: seenWith || undefined,
|
||||||
|
accuracy,
|
||||||
season_id: seasonId,
|
season_id: seasonId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -97,6 +107,19 @@ export function EpisodeSeenEditDialog({
|
|||||||
placeholder="Optional"
|
placeholder="Optional"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label>Date Accuracy</Label>
|
||||||
|
<Select value={accuracy} onValueChange={(v) => setAccuracy(v as SeenAccuracy)}>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="EXACT">Exact</SelectItem>
|
||||||
|
<SelectItem value="ESTIMATED">Estimated</SelectItem>
|
||||||
|
<SelectItem value="UNKNOWN">Unknown</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>Cancel</Button>
|
<Button variant="outline" onClick={() => onOpenChange(false)}>Cancel</Button>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useState } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@@ -22,6 +22,13 @@ export function RatingDialog({ open, onOpenChange, entry }: RatingDialogProps) {
|
|||||||
const [selected, setSelected] = useState<number>(currentRating);
|
const [selected, setSelected] = useState<number>(currentRating);
|
||||||
const updateRatings = useUpdateEntryRatings();
|
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 displayRating = hovered ?? selected;
|
||||||
|
|
||||||
const handleRate = (rating: number) => {
|
const handleRate = (rating: number) => {
|
||||||
@@ -36,6 +43,18 @@ export function RatingDialog({ open, onOpenChange, entry }: RatingDialogProps) {
|
|||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleClear = () => {
|
||||||
|
setSelected(0);
|
||||||
|
updateRatings.mutate({
|
||||||
|
id: entry.id,
|
||||||
|
ratings: {
|
||||||
|
id: entry.entryRatings?.id,
|
||||||
|
user_rating: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
onOpenChange(false);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
<DialogContent className="w-auto sm:max-w-none">
|
<DialogContent className="w-auto sm:max-w-none">
|
||||||
@@ -45,32 +64,51 @@ export function RatingDialog({ open, onOpenChange, entry }: RatingDialogProps) {
|
|||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="flex flex-col items-center gap-4 py-2">
|
<div className="flex flex-col items-center gap-4 py-2">
|
||||||
<div className="flex gap-1.5">
|
<div className="flex gap-0.5">
|
||||||
{Array.from({ length: 10 }, (_, i) => i + 1).map((star) => (
|
{Array.from({ length: 10 }, (_, i) => i + 1).map((star) => {
|
||||||
<button
|
const halfValue = star - 0.5;
|
||||||
key={star}
|
return (
|
||||||
className="transition-transform hover:scale-125 focus:outline-none"
|
<div key={star} className="relative h-8 w-8">
|
||||||
onMouseEnter={() => setHovered(star)}
|
{/* Left half — half star */}
|
||||||
onMouseLeave={() => setHovered(null)}
|
<button
|
||||||
onClick={() => handleRate(star)}
|
className="absolute inset-y-0 left-0 w-1/2 z-10 focus:outline-none"
|
||||||
>
|
onMouseEnter={() => setHovered(halfValue)}
|
||||||
<Star
|
onMouseLeave={() => setHovered(null)}
|
||||||
className={`h-8 w-8 transition-colors ${
|
onClick={() => handleRate(halfValue)}
|
||||||
star <= displayRating
|
/>
|
||||||
? 'fill-yellow-400 text-yellow-400'
|
{/* Right half — full star */}
|
||||||
: 'text-muted-foreground/30'
|
<button
|
||||||
}`}
|
className="absolute inset-y-0 right-0 w-1/2 z-10 focus:outline-none"
|
||||||
/>
|
onMouseEnter={() => setHovered(star)}
|
||||||
</button>
|
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>
|
</div>
|
||||||
|
|
||||||
<p className="text-xl font-semibold tabular-nums">
|
<p className="text-xl font-semibold tabular-nums">
|
||||||
{displayRating > 0 ? `${displayRating} / 10` : '—'}
|
{displayRating > 0 ? `${displayRating} / 10` : '—'}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{selected > 0 && (
|
{(selected > 0 || currentRating > 0) && (
|
||||||
<Button variant="ghost" size="sm" onClick={() => handleRate(0)}>
|
<Button variant="ghost" size="sm" onClick={handleClear}>
|
||||||
Clear rating
|
Clear rating
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Plus, Trash2, Star, Loader2 } from 'lucide-react';
|
import { Plus, Trash2, Star, Loader2, Calendar, Clock } from 'lucide-react';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
} from '@/components/ui/dialog';
|
||||||
import { getPosterUrl, getYear, formatRuntime } from '@/lib/media-utils';
|
import { getPosterUrl, getYear, formatRuntime } from '@/lib/media-utils';
|
||||||
import { useCreateEntry, useDeleteEntry } from '@/hooks/useEntries';
|
import { useCreateEntry, useDeleteEntry } from '@/hooks/useEntries';
|
||||||
import { useLibraryStore } from '@/stores/useLibraryStore';
|
import { useLibraryStore } from '@/stores/useLibraryStore';
|
||||||
@@ -18,6 +24,7 @@ interface EntryCardProps {
|
|||||||
|
|
||||||
export function EntryCard({ entry, tmdbEntry, showTypeBadge }: EntryCardProps) {
|
export function EntryCard({ entry, tmdbEntry, showTypeBadge }: EntryCardProps) {
|
||||||
const [showConfirm, setShowConfirm] = useState(false);
|
const [showConfirm, setShowConfirm] = useState(false);
|
||||||
|
const [showDetailDialog, setShowDetailDialog] = useState(false);
|
||||||
const createEntry = useCreateEntry();
|
const createEntry = useCreateEntry();
|
||||||
const deleteEntry = useDeleteEntry();
|
const deleteEntry = useDeleteEntry();
|
||||||
const libraryEntry = useLibraryStore((s) => {
|
const libraryEntry = useLibraryStore((s) => {
|
||||||
@@ -174,7 +181,13 @@ export function EntryCard({ entry, tmdbEntry, showTypeBadge }: EntryCardProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{entryLink ? <Link to={entryLink}>{card}</Link> : card}
|
{entryLink ? (
|
||||||
|
<Link to={entryLink}>{card}</Link>
|
||||||
|
) : (
|
||||||
|
<div className="cursor-pointer" onClick={() => setShowDetailDialog(true)}>
|
||||||
|
{card}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<ConfirmDialog
|
<ConfirmDialog
|
||||||
open={showConfirm}
|
open={showConfirm}
|
||||||
onOpenChange={setShowConfirm}
|
onOpenChange={setShowConfirm}
|
||||||
@@ -184,6 +197,66 @@ export function EntryCard({ entry, tmdbEntry, showTypeBadge }: EntryCardProps) {
|
|||||||
onConfirm={confirmRemove}
|
onConfirm={confirmRemove}
|
||||||
variant="destructive"
|
variant="destructive"
|
||||||
/>
|
/>
|
||||||
|
{/* Details dialog for non-library entries */}
|
||||||
|
{!entryLink && tmdbEntry && (
|
||||||
|
<Dialog open={showDetailDialog} onOpenChange={setShowDetailDialog}>
|
||||||
|
<DialogContent className="sm:max-w-lg">
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>{title}</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
<div className="flex gap-4">
|
||||||
|
<img
|
||||||
|
src={posterUrl}
|
||||||
|
alt={title}
|
||||||
|
className="h-48 w-32 shrink-0 rounded-lg object-cover"
|
||||||
|
/>
|
||||||
|
<div className="flex-1 space-y-2 min-w-0">
|
||||||
|
<div className="flex flex-wrap items-center gap-2 text-sm text-muted-foreground">
|
||||||
|
{year && (
|
||||||
|
<span className="flex items-center gap-1">
|
||||||
|
<Calendar className="h-3 w-3" />
|
||||||
|
{year}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{isTv ? (
|
||||||
|
<Badge variant="secondary" className="text-[10px]">TV Series</Badge>
|
||||||
|
) : (
|
||||||
|
<Badge variant="secondary" className="text-[10px]">Movie</Badge>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{tmdbEntry.vote_average > 0 && (
|
||||||
|
<div className="flex items-center gap-1 text-sm">
|
||||||
|
<Star className="h-3.5 w-3.5 fill-yellow-400 text-yellow-400" />
|
||||||
|
<span>{tmdbEntry.vote_average.toFixed(1)}/10</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{tmdbEntry.overview && (
|
||||||
|
<p className="text-sm text-muted-foreground line-clamp-6">
|
||||||
|
{tmdbEntry.overview}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
className="mt-2"
|
||||||
|
onClick={(ev) => {
|
||||||
|
ev.stopPropagation();
|
||||||
|
handleAdd(ev);
|
||||||
|
setShowDetailDialog(false);
|
||||||
|
}}
|
||||||
|
disabled={createEntry.isPending}
|
||||||
|
>
|
||||||
|
{createEntry.isPending ? (
|
||||||
|
<Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />
|
||||||
|
) : (
|
||||||
|
<Plus className="mr-1.5 h-3.5 w-3.5" />
|
||||||
|
)}
|
||||||
|
{createEntry.isPending ? 'Adding...' : 'Add to Library'}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export function useCreateEntrySeen() {
|
|||||||
entry_id: number;
|
entry_id: number;
|
||||||
date_seen: string;
|
date_seen: string;
|
||||||
seen_with?: string;
|
seen_with?: string;
|
||||||
|
accuracy?: string;
|
||||||
}) => entrySeenApi.create(data),
|
}) => entrySeenApi.create(data),
|
||||||
onSuccess: (_data, variables) => {
|
onSuccess: (_data, variables) => {
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
@@ -50,7 +51,7 @@ export function useUpdateEntrySeen() {
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
id: number;
|
id: number;
|
||||||
data: { entry_id: number; date_seen?: string; seen_with?: string };
|
data: { entry_id: number; date_seen?: string; seen_with?: string; accuracy?: 'EXACT' | 'ESTIMATED' | 'UNKNOWN' };
|
||||||
}) => entrySeenApi.update(id, data),
|
}) => entrySeenApi.update(id, data),
|
||||||
onSuccess: (_data, variables) => {
|
onSuccess: (_data, variables) => {
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export function useCreateEpisodeSeen() {
|
|||||||
episode_id: number;
|
episode_id: number;
|
||||||
date_seen: string;
|
date_seen: string;
|
||||||
seen_with?: string;
|
seen_with?: string;
|
||||||
|
accuracy?: string;
|
||||||
season_id?: number;
|
season_id?: number;
|
||||||
}) => episodeSeenApi.create(data),
|
}) => episodeSeenApi.create(data),
|
||||||
onSuccess: (_data, variables) => {
|
onSuccess: (_data, variables) => {
|
||||||
@@ -61,7 +62,7 @@ export function useUpdateEpisodeSeen() {
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
id: number;
|
id: number;
|
||||||
data: { episode_id: number; entry_id: number; date_seen?: string; seen_with?: string | null };
|
data: { episode_id: number; entry_id: number; date_seen?: string; seen_with?: string | null; accuracy?: 'EXACT' | 'ESTIMATED' | 'UNKNOWN' };
|
||||||
}) => episodeSeenApi.update(id, data),
|
}) => episodeSeenApi.update(id, data),
|
||||||
onSuccess: (_data, variables) => {
|
onSuccess: (_data, variables) => {
|
||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState } from 'react';
|
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 { useEntry, useEntrySeasons, useRefreshEntry } from '@/hooks/useEntries';
|
||||||
import { useEntrySeenByEntry, useDeleteEntrySeen } from '@/hooks/useEntrySeen';
|
import { useEntrySeenByEntry, useDeleteEntrySeen } from '@/hooks/useEntrySeen';
|
||||||
import { useCollections } from '@/hooks/useCollections';
|
import { useCollections } from '@/hooks/useCollections';
|
||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from '@/components/ui/dropdown-menu';
|
} from '@/components/ui/dropdown-menu';
|
||||||
import {
|
import {
|
||||||
@@ -24,8 +25,9 @@ import {
|
|||||||
ImageIcon,
|
ImageIcon,
|
||||||
Settings,
|
Settings,
|
||||||
Star,
|
Star,
|
||||||
Loader2,
|
|
||||||
History,
|
History,
|
||||||
|
Trash2,
|
||||||
|
ExternalLink,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@@ -35,13 +37,14 @@ import {
|
|||||||
} from '@/components/ui/tooltip';
|
} from '@/components/ui/tooltip';
|
||||||
import { CastList } from '@/components/entries/CastList';
|
import { CastList } from '@/components/entries/CastList';
|
||||||
import { SeasonsContainer } from '@/components/entries/SeasonsContainer';
|
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 { EntrySettingsDialog } from '@/components/dialogs/EntrySettingsDialog';
|
||||||
import { EntrySeenDialog } from '@/components/dialogs/EntrySeenDialog';
|
import { EntrySeenDialog } from '@/components/dialogs/EntrySeenDialog';
|
||||||
import { EntryMediaDialog } from '@/components/dialogs/EntryMediaDialog';
|
import { EntryMediaDialog } from '@/components/dialogs/EntryMediaDialog';
|
||||||
import { AddEntryToCollectionDialog } from '@/components/dialogs/AddEntryToCollectionDialog';
|
import { AddEntryToCollectionDialog } from '@/components/dialogs/AddEntryToCollectionDialog';
|
||||||
import { RatingDialog } from '@/components/dialogs/RatingDialog';
|
import { RatingDialog } from '@/components/dialogs/RatingDialog';
|
||||||
import { MovieWatchHistoryDialog } from '@/components/dialogs/MovieWatchHistoryDialog';
|
import { MovieWatchHistoryDialog } from '@/components/dialogs/MovieWatchHistoryDialog';
|
||||||
|
import { ConfirmDialog } from '@/components/dialogs/ConfirmDialog';
|
||||||
import { EntryDetailsSkeleton } from '@/components/skeletons/PageSkeletons';
|
import { EntryDetailsSkeleton } from '@/components/skeletons/PageSkeletons';
|
||||||
import {
|
import {
|
||||||
getPosterUrl,
|
getPosterUrl,
|
||||||
@@ -51,18 +54,20 @@ import {
|
|||||||
formatRuntime,
|
formatRuntime,
|
||||||
formatDate,
|
formatDate,
|
||||||
} from '@/lib/media-utils';
|
} from '@/lib/media-utils';
|
||||||
import { useUpdateEntry } from '@/hooks/useEntries';
|
import { useUpdateEntry, useDeleteEntry } from '@/hooks/useEntries';
|
||||||
import type { Collection, Entry } from '@/types';
|
import type { Collection, Entry } from '@/types';
|
||||||
|
|
||||||
export function EntryDetailsPage() {
|
export function EntryDetailsPage() {
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<{ id: string }>();
|
||||||
const entryId = parseInt(id!, 10);
|
const entryId = parseInt(id!, 10);
|
||||||
|
const navigate = useNavigate();
|
||||||
const { data: entry, isLoading } = useEntry(entryId);
|
const { data: entry, isLoading } = useEntry(entryId);
|
||||||
const { data: seasons } = useEntrySeasons(entryId);
|
const { data: seasons } = useEntrySeasons(entryId);
|
||||||
const { data: watchHistory = [] } = useEntrySeenByEntry(entryId);
|
const { data: watchHistory = [] } = useEntrySeenByEntry(entryId);
|
||||||
const updateEntry = useUpdateEntry();
|
const updateEntry = useUpdateEntry();
|
||||||
const refreshEntry = useRefreshEntry();
|
const refreshEntry = useRefreshEntry();
|
||||||
const deleteEntrySeen = useDeleteEntrySeen();
|
const deleteEntrySeen = useDeleteEntrySeen();
|
||||||
|
const deleteEntry = useDeleteEntry();
|
||||||
|
|
||||||
// Merge library entry with detail entry so we get both library flags AND full details (credits, etc.)
|
// 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));
|
const libraryEntry = useLibraryStore((s) => s.entries.get(entryId));
|
||||||
@@ -76,6 +81,7 @@ export function EntryDetailsPage() {
|
|||||||
const [showCollectionDialog, setShowCollectionDialog] = useState(false);
|
const [showCollectionDialog, setShowCollectionDialog] = useState(false);
|
||||||
const [showRatingDialog, setShowRatingDialog] = useState(false);
|
const [showRatingDialog, setShowRatingDialog] = useState(false);
|
||||||
const [showWatchHistoryDialog, setShowWatchHistoryDialog] = useState(false);
|
const [showWatchHistoryDialog, setShowWatchHistoryDialog] = useState(false);
|
||||||
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||||
|
|
||||||
if (isLoading || !displayEntry) {
|
if (isLoading || !displayEntry) {
|
||||||
return <EntryDetailsSkeleton />;
|
return <EntryDetailsSkeleton />;
|
||||||
@@ -112,41 +118,6 @@ export function EntryDetailsPage() {
|
|||||||
<div className="mx-auto max-w-4xl">
|
<div className="mx-auto max-w-4xl">
|
||||||
{/* Action buttons — top right */}
|
{/* Action buttons — top right */}
|
||||||
<div className="flex justify-end gap-1 -mt-10 relative z-10 mb-2">
|
<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>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button variant="ghost" size="icon" className="h-9 w-9">
|
<Button variant="ghost" size="icon" className="h-9 w-9">
|
||||||
@@ -154,6 +125,11 @@ export function EntryDetailsPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end" className="w-56">
|
<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)}>
|
<DropdownMenuItem onClick={() => setShowRatingDialog(true)}>
|
||||||
<Star className="mr-2 h-4 w-4" />
|
<Star className="mr-2 h-4 w-4" />
|
||||||
Rate this
|
Rate this
|
||||||
@@ -164,6 +140,16 @@ export function EntryDetailsPage() {
|
|||||||
Watch History
|
Watch History
|
||||||
</DropdownMenuItem>
|
</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
|
<DropdownMenuItem
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
updateEntry.mutate({ id: e.id, data: { hidden: !e.hidden } })
|
updateEntry.mutate({ id: e.id, data: { hidden: !e.hidden } })
|
||||||
@@ -172,14 +158,12 @@ export function EntryDetailsPage() {
|
|||||||
<EyeOff className="mr-2 h-4 w-4" />
|
<EyeOff className="mr-2 h-4 w-4" />
|
||||||
{e.hidden ? 'Unhide' : 'Hide'}
|
{e.hidden ? 'Unhide' : 'Hide'}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
|
{/* Manage */}
|
||||||
<DropdownMenuItem onClick={() => refreshEntry.mutate(e.id)} disabled={refreshEntry.isPending}>
|
<DropdownMenuItem onClick={() => refreshEntry.mutate(e.id)} disabled={refreshEntry.isPending}>
|
||||||
<RefreshCw className={`mr-2 h-4 w-4 ${refreshEntry.isPending ? 'animate-spin' : ''}`} />
|
<RefreshCw className={`mr-2 h-4 w-4 ${refreshEntry.isPending ? 'animate-spin' : ''}`} />
|
||||||
{refreshEntry.isPending ? 'Refreshing...' : 'Refresh details'}
|
{refreshEntry.isPending ? 'Refreshing...' : 'Refresh details'}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={() => setShowCollectionDialog(true)}>
|
|
||||||
<FolderPlus className="mr-2 h-4 w-4" />
|
|
||||||
Add to collection
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onClick={() => setShowMediaDialog(true)}>
|
<DropdownMenuItem onClick={() => setShowMediaDialog(true)}>
|
||||||
<ImageIcon className="mr-2 h-4 w-4" />
|
<ImageIcon className="mr-2 h-4 w-4" />
|
||||||
Manage media
|
Manage media
|
||||||
@@ -188,6 +172,15 @@ export function EntryDetailsPage() {
|
|||||||
<Settings className="mr-2 h-4 w-4" />
|
<Settings className="mr-2 h-4 w-4" />
|
||||||
Settings
|
Settings
|
||||||
</DropdownMenuItem>
|
</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>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</div>
|
</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">
|
<div className="flex flex-col gap-6 relative items-start sm:flex-row sm:gap-8 sm:-mt-8">
|
||||||
{/* LEFT: Sticky poster */}
|
{/* LEFT: Sticky poster */}
|
||||||
<div className="sm:sticky sm:top-20 w-32 sm:w-44 shrink-0 self-start mx-auto sm:mx-0">
|
<div className="sm:sticky sm:top-20 w-32 sm:w-44 shrink-0 self-start mx-auto sm:mx-0">
|
||||||
<img
|
<div className="relative">
|
||||||
src={poster}
|
{e.favorit && (
|
||||||
alt={e.title}
|
<div className="absolute top-2 left-2 z-10 rounded-full bg-background/80 p-1 backdrop-blur-sm">
|
||||||
className="w-full aspect-2/3 rounded-xl object-cover shadow-2xl ring-1 ring-border/50"
|
<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>
|
</div>
|
||||||
|
|
||||||
{/* RIGHT: Entry info */}
|
{/* RIGHT: Entry info */}
|
||||||
<div className="flex-1 min-w-0 space-y-4">
|
<div className="flex-1 min-w-0 space-y-4">
|
||||||
{/* Title + status + director */}
|
{/* Title + director */}
|
||||||
<div className="space-y-1">
|
<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>
|
||||||
<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>
|
|
||||||
{director?.people?.name && (
|
{director?.people?.name && (
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
by{' '}
|
by{' '}
|
||||||
@@ -244,6 +264,12 @@ export function EntryDetailsPage() {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
)}
|
)}
|
||||||
|
{e.is_tvseries && e.status && (
|
||||||
|
<>
|
||||||
|
<span>•</span>
|
||||||
|
<span>{e.status}</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{e.runtime && !e.is_tvseries && (
|
{e.runtime && !e.is_tvseries && (
|
||||||
<>
|
<>
|
||||||
<span>•</span>
|
<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>
|
</div>
|
||||||
|
|
||||||
{/* Genres */}
|
{/* Genres */}
|
||||||
{e.genres && e.genres.length > 0 && (
|
{e.genres && e.genres.length > 0 && (
|
||||||
<div className="flex flex-wrap gap-1.5">
|
<div className="flex flex-wrap gap-1.5">
|
||||||
{e.genres.map((g) => (
|
{e.genres.map((g) => (
|
||||||
<Badge key={g.id} variant="outline" className="text-xs">
|
<Link key={g.id} to={`/library?genre=${encodeURIComponent(g.name)}`}>
|
||||||
{g.name}
|
<Badge variant="outline" className="text-xs cursor-pointer hover:bg-accent transition-colors">
|
||||||
</Badge>
|
{g.name}
|
||||||
|
</Badge>
|
||||||
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useParams, useNavigate } from 'react-router-dom';
|
import { useParams, useNavigate, Link } from 'react-router-dom';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { seasonsApi } from '@/api/seasons';
|
import { seasonsApi } from '@/api/seasons';
|
||||||
import {
|
import {
|
||||||
@@ -57,6 +57,23 @@ export function EpisodePage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8">
|
<div className="space-y-8">
|
||||||
|
{/* Back navigation */}
|
||||||
|
<div className="flex items-center gap-3 text-sm text-muted-foreground">
|
||||||
|
<Link
|
||||||
|
to={`/entry/${entryId}`}
|
||||||
|
className="hover:text-foreground transition-colors"
|
||||||
|
>
|
||||||
|
Entry
|
||||||
|
</Link>
|
||||||
|
<span>/</span>
|
||||||
|
<Link
|
||||||
|
to={`/entry/${entryId}/season/${seasonId}`}
|
||||||
|
className="hover:text-foreground transition-colors"
|
||||||
|
>
|
||||||
|
Season
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Top bar: nav breadcrumb + Mark Watched */}
|
{/* Top bar: nav breadcrumb + Mark Watched */}
|
||||||
<div className="flex items-center justify-between gap-4">
|
<div className="flex items-center justify-between gap-4">
|
||||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ import { Skeleton } from '@/components/ui/skeleton';
|
|||||||
import { Progress } from '@/components/ui/progress';
|
import { Progress } from '@/components/ui/progress';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Eye, CheckCircle2, ListChecks } from 'lucide-react';
|
import { Eye, CheckCircle2, ListChecks, ArrowLeft } from 'lucide-react';
|
||||||
import { getTmdbPosterUrl, getYear, formatDate } from '@/lib/media-utils';
|
import { getTmdbPosterUrl, getYear, formatDate } from '@/lib/media-utils';
|
||||||
import type { Episode } from '@/types';
|
import type { Episode } from '@/types';
|
||||||
|
import type { SeenAccuracy } from '@/types';
|
||||||
|
|
||||||
export function SeasonPage() {
|
export function SeasonPage() {
|
||||||
const { entryId, seasonId } = useParams<{
|
const { entryId, seasonId } = useParams<{
|
||||||
@@ -25,6 +26,7 @@ export function SeasonPage() {
|
|||||||
const [showMarkAllDialog, setShowMarkAllDialog] = useState(false);
|
const [showMarkAllDialog, setShowMarkAllDialog] = useState(false);
|
||||||
const [markAllDate, setMarkAllDate] = useState(new Date().toISOString().split('T')[0]);
|
const [markAllDate, setMarkAllDate] = useState(new Date().toISOString().split('T')[0]);
|
||||||
const [markAllSeenWith, setMarkAllSeenWith] = useState('');
|
const [markAllSeenWith, setMarkAllSeenWith] = useState('');
|
||||||
|
const [markAllAccuracy, setMarkAllAccuracy] = useState<SeenAccuracy>('EXACT');
|
||||||
const [showMarkAllConfirm, setShowMarkAllConfirm] = useState(false);
|
const [showMarkAllConfirm, setShowMarkAllConfirm] = useState(false);
|
||||||
|
|
||||||
if (isLoading || !season) {
|
if (isLoading || !season) {
|
||||||
@@ -52,6 +54,15 @@ export function SeasonPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8 animate-page-enter">
|
<div className="space-y-8 animate-page-enter">
|
||||||
|
{/* Back to entry */}
|
||||||
|
<Link
|
||||||
|
to={`/entry/${entryId}`}
|
||||||
|
className="inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors"
|
||||||
|
>
|
||||||
|
<ArrowLeft className="h-4 w-4" />
|
||||||
|
Back to entry
|
||||||
|
</Link>
|
||||||
|
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="flex gap-6">
|
<div className="flex gap-6">
|
||||||
<img
|
<img
|
||||||
@@ -205,9 +216,10 @@ export function SeasonPage() {
|
|||||||
episodeId={-1}
|
episodeId={-1}
|
||||||
entryId={parseInt(entryId!, 10)}
|
entryId={parseInt(entryId!, 10)}
|
||||||
seasonId={parseInt(seasonId!, 10)}
|
seasonId={parseInt(seasonId!, 10)}
|
||||||
overrideSubmit={(date, seenWith) => {
|
overrideSubmit={(date, seenWith, accuracy) => {
|
||||||
setMarkAllDate(date);
|
setMarkAllDate(date);
|
||||||
setMarkAllSeenWith(seenWith);
|
setMarkAllSeenWith(seenWith);
|
||||||
|
setMarkAllAccuracy(accuracy);
|
||||||
setShowMarkAllDialog(false);
|
setShowMarkAllDialog(false);
|
||||||
setShowMarkAllConfirm(true);
|
setShowMarkAllConfirm(true);
|
||||||
}}
|
}}
|
||||||
@@ -233,6 +245,7 @@ export function SeasonPage() {
|
|||||||
episode_id: ep.id,
|
episode_id: ep.id,
|
||||||
date_seen: markAllDate,
|
date_seen: markAllDate,
|
||||||
seen_with: markAllSeenWith || undefined,
|
seen_with: markAllSeenWith || undefined,
|
||||||
|
accuracy: markAllAccuracy,
|
||||||
season_id: parseInt(seasonId!, 10),
|
season_id: parseInt(seasonId!, 10),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,11 +102,14 @@ export interface Episode {
|
|||||||
season?: Season;
|
season?: Season;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type SeenAccuracy = 'EXACT' | 'ESTIMATED' | 'UNKNOWN';
|
||||||
|
|
||||||
export interface EntrySeen {
|
export interface EntrySeen {
|
||||||
id: number;
|
id: number;
|
||||||
entry_id: number;
|
entry_id: number;
|
||||||
date_seen: string;
|
date_seen: string;
|
||||||
seen_with: string | null;
|
seen_with: string | null;
|
||||||
|
accuracy: SeenAccuracy;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
}
|
}
|
||||||
@@ -117,6 +120,7 @@ export interface EpisodeSeen {
|
|||||||
episode_id: number;
|
episode_id: number;
|
||||||
date_seen: string;
|
date_seen: string;
|
||||||
seen_with: string | null;
|
seen_with: string | null;
|
||||||
|
accuracy: SeenAccuracy;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user