+ {thumbSrc && (

)}
-
+
- {entryTitle}
+ {entryTitle || 'Unknown'}
-
+
{seasonLabel} {episodeLabel}
@@ -181,13 +175,15 @@ function EpisodeCalendarItem({ episode }: { episode: Episode }) {
)}
- {entryTitle}
- {episode.name && (
- {episode.name}
- )}
-
- {seasonLabel} {episodeLabel}
-
+
+
{entryTitle}
+ {episode.name && (
+
{episode.name}
+ )}
+
+ {seasonLabel} {episodeLabel}
+
+
);
diff --git a/react_frontend/src/pages/EntryDetailsPage.tsx b/react_frontend/src/pages/EntryDetailsPage.tsx
index 7fd1317..a5ad767 100644
--- a/react_frontend/src/pages/EntryDetailsPage.tsx
+++ b/react_frontend/src/pages/EntryDetailsPage.tsx
@@ -189,14 +189,14 @@ export function EntryDetailsPage() {
)}
- {director && (
+ {director?.people?.name && (
by{' '}
- {director.people?.name}
+ {director.people.name}
)}
diff --git a/react_frontend/src/pages/EpisodePage.tsx b/react_frontend/src/pages/EpisodePage.tsx
index 6e4d644..8a588e7 100644
--- a/react_frontend/src/pages/EpisodePage.tsx
+++ b/react_frontend/src/pages/EpisodePage.tsx
@@ -1,16 +1,21 @@
import { useState } from 'react';
-import { useParams, Link } from 'react-router-dom';
+import { useParams, useNavigate } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
import { seasonsApi } from '@/api/seasons';
-import { useEpisodeSeenByEpisode, useCreateEpisodeSeen } from '@/hooks/useEpisodeSeen';
+import {
+ useEpisodeSeenByEpisode,
+ useDeleteEpisodeSeen,
+} from '@/hooks/useEpisodeSeen';
import { Skeleton } from '@/components/ui/skeleton';
import { Button } from '@/components/ui/button';
import { Separator } from '@/components/ui/separator';
import { EpisodeWatchHistory } from '@/components/entries/EpisodeWatchHistory';
+import { EpisodeSeenEditDialog } from '@/components/dialogs/EpisodeSeenEditDialog';
+import { ConfirmDialog } from '@/components/dialogs/ConfirmDialog';
import { CastList } from '@/components/entries/CastList';
import { Eye, ChevronLeft, ChevronRight, Clock } from 'lucide-react';
import { getTmdbPosterUrl, formatDate, formatRuntime } from '@/lib/media-utils';
-import type { Episode } from '@/types';
+import type { Episode, EpisodeSeen } from '@/types';
export function EpisodePage() {
const { entryId, seasonId, episodeId } = useParams<{
@@ -18,6 +23,7 @@ export function EpisodePage() {
seasonId: string;
episodeId: string;
}>();
+ const navigate = useNavigate();
const { data: episodes = [] } = useQuery({
queryKey: ['seasons', parseInt(seasonId!, 10), 'episodes'],
@@ -25,9 +31,15 @@ export function EpisodePage() {
});
const epId = parseInt(episodeId!, 10);
+ const entryIdNum = parseInt(entryId!, 10);
const episode: Episode | undefined = episodes.find((ep: Episode) => ep.id === epId);
const { data: watchHistory = [] } = useEpisodeSeenByEpisode(epId);
const createEpisodeSeen = useCreateEpisodeSeen();
+ const deleteEpisodeSeen = useDeleteEpisodeSeen();
+
+ const [editRecord, setEditRecord] = useState
(null);
+ const [deleteTarget, setDeleteTarget] = useState(null);
+ const [showAddDialog, setShowAddDialog] = useState(false);
// Find prev/next episode
const currentIndex = episodes.findIndex((ep: Episode) => ep.id === epId);
@@ -45,35 +57,35 @@ export function EpisodePage() {
);
}
- const handleMarkWatched = () => {
- createEpisodeSeen.mutate({
- entry_id: parseInt(entryId!, 10),
- episode_id: episode.id,
- date_seen: new Date().toISOString().split('T')[0],
- });
- };
-
return (
- {/* Thumbnail */}
+ {/* Top bar: nav breadcrumb + Mark Watched */}
+
+
+
+ S{String(parseInt(seasonId!, 10)).padStart(2, '0')} E{String(episode.episode_number).padStart(2, '0')}
+
+
+
+
+
+ {/* High-quality thumbnail */}
{episode.still_path && (
-
+
)}
{/* Info */}
-
-
- Episode {episode.episode_number}
-
-
{episode.name}
-
+
{episode.name}
{episode.air_date && {formatDate(episode.air_date)}}
@@ -90,11 +102,6 @@ export function EpisodePage() {
{episode.overview}
)}
-
-
{/* Guest Stars */}
@@ -109,38 +116,93 @@ export function EpisodePage() {
{watchHistory.length > 0 && (
<>
-
+
{
+ const rec = watchHistory.find((r) => r.id === id) as EpisodeSeen | undefined;
+ if (rec) setEditRecord(rec);
+ }}
+ onDelete={(id) => setDeleteTarget(id)}
+ />
>
)}
- {/* Navigation */}
+ {/* Prev / Next navigation */}
-
+
{prevEpisode ? (
-
+
+ {/* Add watch record dialog */}
+ {showAddDialog && (
+
+ )}
+
+ {/* Edit dialog */}
+ {editRecord && (
+
{ if (!open) setEditRecord(null); }}
+ mode="edit"
+ record={editRecord}
+ entryId={entryIdNum}
+ />
+ )}
+
+ {/* Delete confirm dialog */}
+ { if (!open) setDeleteTarget(null); }}
+ title="Delete Watch Record"
+ description="Are you sure you want to remove this watch record? This cannot be undone."
+ confirmLabel="Delete"
+ variant="destructive"
+ onConfirm={() => {
+ if (deleteTarget !== null) {
+ deleteEpisodeSeen.mutate({ id: deleteTarget, entryId: entryIdNum, episodeId: epId });
+ setDeleteTarget(null);
+ }
+ }}
+ />
);
}
diff --git a/react_frontend/src/pages/PersonDetailsPage.tsx b/react_frontend/src/pages/PersonDetailsPage.tsx
index 8a86508..de399da 100644
--- a/react_frontend/src/pages/PersonDetailsPage.tsx
+++ b/react_frontend/src/pages/PersonDetailsPage.tsx
@@ -1,14 +1,16 @@
import { useParams } from 'react-router-dom';
+import { useState } from 'react';
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 { Badge } from '@/components/ui/badge';
+import { Button } from '@/components/ui/button';
import { EntryCard } from '@/components/entries/EntryCard';
import { getProfileUrl, formatDate } from '@/lib/media-utils';
-import { getTmdbImageUrl } from '@/lib/api';
+import { ChevronLeft, ChevronRight } from 'lucide-react';
+import type { TmdbEntry } from '@/types';
import type { TmdbFilmographyItem } from '@/api/people';
export function PersonDetailsPage() {
@@ -80,12 +82,17 @@ interface FilmographySectionProps {
}
function FilmographySection({ libraryMap, libraryLoaded, tmdbFilmography, tmdbLoading }: FilmographySectionProps) {
+ const [libraryPage, setLibraryPage] = useState(0);
+ const [otherPage, setOtherPage] = useState(0);
+ const PAGE_SIZE = 6; // 6 cols × 1 row
+ const GRID = 'grid grid-cols-3 gap-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6';
+
if (tmdbLoading || !libraryLoaded) {
return (
Filmography
-
- {Array.from({ length: 10 }).map((_, i) => (
+
+ {Array.from({ length: 6 }).map((_, i) => (
))}
@@ -111,10 +118,12 @@ function FilmographySection({ libraryMap, libraryLoaded, tmdbFilmography, tmdbLo
}
}
- const libraryCredits = dedupedCredits.filter((c) => tmdbIdToLibraryEntry.has(c.id));
- const otherCredits = dedupedCredits.filter((c) => !tmdbIdToLibraryEntry.has(c.id));
+ // Sort by popularity descending
+ const sorted = [...dedupedCredits].sort((a, b) => (b.popularity ?? 0) - (a.popularity ?? 0));
+ const libraryCredits = sorted.filter((c) => tmdbIdToLibraryEntry.has(c.id));
+ const otherCredits = sorted.filter((c) => !tmdbIdToLibraryEntry.has(c.id));
- if (dedupedCredits.length === 0) {
+ if (sorted.length === 0) {
return (
Filmography
@@ -123,15 +132,45 @@ function FilmographySection({ libraryMap, libraryLoaded, tmdbFilmography, tmdbLo
);
}
+ const librarySlice = libraryCredits.slice(libraryPage * PAGE_SIZE, (libraryPage + 1) * PAGE_SIZE);
+ const otherSlice = otherCredits.slice(otherPage * PAGE_SIZE, (otherPage + 1) * PAGE_SIZE);
+ const libraryTotalPages = Math.ceil(libraryCredits.length / PAGE_SIZE);
+ const otherTotalPages = Math.ceil(otherCredits.length / PAGE_SIZE);
+
return (
Filmography
{libraryCredits.length > 0 && (
-
In Your Library
-
- {libraryCredits.map((credit) => {
+
+
+ In Your Library ({libraryCredits.length})
+
+ {libraryTotalPages > 1 && (
+
+ setLibraryPage((p) => p - 1)}
+ >
+
+
+
+ {libraryPage + 1}/{libraryTotalPages}
+
+ setLibraryPage((p) => p + 1)}
+ >
+
+
+
+ )}
+
+
+ {librarySlice.map((credit) => {
const entry = tmdbIdToLibraryEntry.get(credit.id)!;
return (
@@ -148,23 +187,52 @@ function FilmographySection({ libraryMap, libraryLoaded, tmdbFilmography, tmdbLo
{otherCredits.length > 0 && (
-
Not in Library
-
- {otherCredits.map((credit) => {
- const title = credit.title ?? credit.name ?? 'Unknown';
- const posterSrc = credit.poster_path
- ? getTmdbImageUrl(credit.poster_path, 'w342')
- : '/images/default-poster.png';
+
+
+ Not in Library ({otherCredits.length})
+
+ {otherTotalPages > 1 && (
+
+ setOtherPage((p) => p - 1)}
+ >
+
+
+
+ {otherPage + 1}/{otherTotalPages}
+
+ setOtherPage((p) => p + 1)}
+ >
+
+
+
+ )}
+
+
+ {otherSlice.map((credit) => {
+ const tmdbEntry: TmdbEntry = {
+ id: credit.id,
+ title: credit.title,
+ name: credit.name,
+ poster_path: credit.poster_path,
+ backdrop_path: null,
+ release_date: credit.release_date,
+ first_air_date: credit.first_air_date,
+ media_type: credit.media_type,
+ overview: '',
+ vote_average: 0,
+ vote_count: 0,
+ genre_ids: [],
+ popularity: credit.popularity ?? 0,
+ };
return (
-
-

-
-
{title}
-
- {credit.media_type === 'tv' ? 'TV' : 'Movie'}
-
-
+
{credit.character && (
{credit.character}
)}