Director field, search, and collection improvements

Backend: Added director column to Entry model, set during creation and
refresh. Maintenance endpoint to scan/fix missing directors. Reverted
expensive credit JOIN in getAllEntries.

Frontend: @director: search prefix for Library and Watchlist. Director
rendered on EntryDetailsPage via useEntryCredits. Fixed home page cards
to link directly to EntryDetailsPage when entry is in library. Added
TmdbCastsPage for TMDB cast browsing. Persisted collection sort order
and gray-out-unseen toggle. Tooltip component now theme-aware.
This commit is contained in:
X4Lo committed 2026-06-18 20:09:11 +01:00
1 parent 8671184dc5
commit 5a0328a17f
16 files changed
+1679 -629

No files matched your search

+66 -29
View File
@@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useState, useEffect } from "react";
import {
useTrendingMovies,
useTrendingTv,
@@ -7,9 +7,9 @@ import {
useTopRatedMovies,
useTopRatedTv,
useUpcomingMovies,
} from '@/hooks/useTmdb';
import { useLibrary } from '@/hooks/useEntries';
import { TrendingUp, Play, Award, Calendar } from 'lucide-react';
} from "@/hooks/useTmdb";
import { useLibrary } from "@/hooks/useEntries";
import { TrendingUp, Play, Award, Calendar } from "lucide-react";
import {
HeroSlider,
BackdropCard,
@@ -18,7 +18,7 @@ import {
UpcomingCard,
SectionHeader,
PopularBelt,
} from '@/components/home';
} from "@/components/home";
export function HomePage() {
useLibrary();
@@ -31,31 +31,43 @@ export function HomePage() {
const topRatedTv = useTopRatedTv();
const upcomingMovies = useUpcomingMovies();
const trendingMovieEntries = trendingMovies.data?.pages.flatMap((p) => p.results) ?? [];
const trendingTvEntries = trendingTv.data?.pages.flatMap((p) => p.results) ?? [];
const popularMovieEntries = popularMovies.data?.pages.flatMap((p) => p.results) ?? [];
const popularTvEntries = popularTv.data?.pages.flatMap((p) => p.results) ?? [];
const topRatedMovieEntries = topRatedMovies.data?.pages.flatMap((p) => p.results) ?? [];
const topRatedTvEntries = topRatedTv.data?.pages.flatMap((p) => p.results) ?? [];
const upcomingMovieEntries = upcomingMovies.data?.pages.flatMap((p) => p.results) ?? [];
const trendingMovieEntries =
trendingMovies.data?.pages.flatMap((p) => p.results) ?? [];
const trendingTvEntries =
trendingTv.data?.pages.flatMap((p) => p.results) ?? [];
const popularMovieEntries =
popularMovies.data?.pages.flatMap((p) => p.results) ?? [];
const popularTvEntries =
popularTv.data?.pages.flatMap((p) => p.results) ?? [];
const topRatedMovieEntries =
topRatedMovies.data?.pages.flatMap((p) => p.results) ?? [];
const topRatedTvEntries =
topRatedTv.data?.pages.flatMap((p) => p.results) ?? [];
const upcomingMovieEntries =
upcomingMovies.data?.pages.flatMap((p) => p.results) ?? [];
// Trending grid auto-rotation: exit -> swap -> enter
const [trendingIdx, setTrendingIdx] = useState(0);
const [trendingPhase, setTrendingPhase] = useState<'idle' | 'exit' | 'enter'>('idle');
const [trendingPhase, setTrendingPhase] = useState<"idle" | "exit" | "enter">(
"idle",
);
const trendingPool = trendingMovieEntries.slice(2);
const visibleTrending =
trendingPool.length >= 4
? [0, 1, 2, 3].map((offset) => trendingPool[(trendingIdx + offset) % trendingPool.length])
? [0, 1, 2, 3].map(
(offset) =>
trendingPool[(trendingIdx + offset) % trendingPool.length],
)
: trendingPool;
useEffect(() => {
if (trendingPool.length <= 4) return;
const timer = setInterval(() => {
setTrendingPhase('exit');
setTrendingPhase("exit");
setTimeout(() => {
setTrendingIdx((i) => i + 1);
setTrendingPhase('enter');
setTimeout(() => setTrendingPhase('idle'), 600);
setTrendingPhase("enter");
setTimeout(() => setTrendingPhase("idle"), 600);
}, 380);
}, 7000);
return () => clearInterval(timer);
@@ -91,19 +103,27 @@ export function HomePage() {
<div
className="xl:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4 overflow-hidden"
style={{
opacity: trendingPhase === 'exit' ? 0 : 1,
transform: trendingPhase === 'exit' ? 'translateX(-28px)' : 'translateX(0)',
transition: trendingPhase === 'exit'
? 'opacity 380ms ease, transform 380ms ease'
: 'none',
opacity: trendingPhase === "exit" ? 0 : 1,
transform:
trendingPhase === "exit"
? "translateX(-28px)"
: "translateX(0)",
transition:
trendingPhase === "exit"
? "opacity 380ms ease, transform 380ms ease"
: "none",
}}
>
{visibleTrending.map((item, i) => (
<BackdropCard
key={`${item.id}-${trendingIdx}`}
entry={item}
animClass={trendingPhase === 'enter' ? 'animate-slide-from-right' : undefined}
animDelay={trendingPhase === 'enter' ? i * 90 : 0}
animClass={
trendingPhase === "enter"
? "animate-slide-from-right"
: undefined
}
animDelay={trendingPhase === "enter" ? i * 90 : 0}
/>
))}
</div>
@@ -126,7 +146,10 @@ export function HomePage() {
title="Popular Right Now"
category="popular"
/>
<PopularBelt movieEntries={popularMovieEntries} tvEntries={popularTvEntries} />
<PopularBelt
movieEntries={popularMovieEntries}
tvEntries={popularTvEntries}
/>
</section>
{/* Top Rated */}
@@ -172,7 +195,12 @@ export function HomePage() {
/>
<div
className="flex gap-3 overflow-x-auto pb-2"
style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' } as React.CSSProperties}
style={
{
scrollbarWidth: "none",
msOverflowStyle: "none",
} as React.CSSProperties
}
>
{upcomingMovieEntries.slice(0, 14).map((item) => (
<UpcomingCard key={item.id} entry={item} />
@@ -187,13 +215,22 @@ function HomeLoadingSkeleton() {
return (
<div className="animate-pulse space-y-12 pb-12">
<div className="-mx-4 -mt-18 md:-mx-6 md:-mt-6">
<div className="w-full bg-muted" style={{ aspectRatio: '16/9', maxHeight: '70vh' }} />
<div
className="w-full bg-muted"
style={{ aspectRatio: "16/9", maxHeight: "70vh" }}
/>
</div>
<div className="space-y-4">
<div className="h-6 w-48 rounded bg-muted" />
<div className="grid grid-cols-2 gap-4">
<div className="rounded-xl bg-muted" style={{ aspectRatio: '16/9' }} />
<div className="rounded-xl bg-muted" style={{ aspectRatio: '16/9' }} />
<div
className="rounded-xl bg-muted"
style={{ aspectRatio: "16/9" }}
/>
<div
className="rounded-xl bg-muted"
style={{ aspectRatio: "16/9" }}
/>
</div>
</div>
</div>