feat: multi-page improvements, bug fixes, and new features
Library: - Exclude hidden entries from all/movies/tv/favorites tabs (only show in hidden tab) Entry Details: - Move favorite, mark watched, and more actions to top-right as icon-only buttons with tooltips - Fix season card play button — marks next unwatched episode as seen Seasons Page: - Fix episode watch button (was a TODO stub, now calls createEpisodeSeen) Episode Page: - Fix UI not updating after deleting the last watch record — invalidate season episodes query on delete Dashboard: - Fix Top Genres 404 — was calling non-existent GET /statistics, now uses /statistics/watch-time - Fix TopGenresChart genre counting (Genre objects were wrongly cast as strings) - Add LibraryGrowthChart (cumulative titles added over time) - Add MediaTypeChart (Movies vs TV Series donut chart) Home Page: - Add TrendingSlider hero at top of page with auto-advance, dots, and prev/next nav - Fix slider prev/next buttons (stable callbacks via ref, plain buttons, reactive library state) - Add debounce (400ms) to search input - Add Top Rated section (movies & TV) - Add Upcoming section (movies) - Replace inline "More" expand with link to /discover/:category Discover Page (new): - Full-page TMDB browser per category (trending/popular/top-rated/upcoming) - Movie/TV tab toggle - IntersectionObserver infinite scroll Calendar: - Fix large season numbers — use season.season_number instead of season_id (DB primary key) Backend: - Add fetchTopRated() and fetchUpcoming() to tmdbService - Add GET /entries/tmdb/top-rated/:type and /entries/tmdb/upcoming/movie routes
This commit is contained in:
1 parent
d60d142d17
commit
ab20a5e64f
23 files changed
+820
-104
No files matched your search
@@ -1,13 +1,35 @@
|
||||
import { useTrendingMovies, useTrendingTv, usePopularMovies, usePopularTv, useTmdbSearch } from '@/hooks/useTmdb';
|
||||
import {
|
||||
useTrendingMovies,
|
||||
useTrendingTv,
|
||||
usePopularMovies,
|
||||
usePopularTv,
|
||||
useTopRatedMovies,
|
||||
useTopRatedTv,
|
||||
useUpcomingMovies,
|
||||
useTmdbSearch,
|
||||
} from '@/hooks/useTmdb';
|
||||
import { useLibrary } from '@/hooks/useEntries';
|
||||
import { TrendingGrid } from '@/components/entries/TrendingGrid';
|
||||
import { TrendingSlider } from '@/components/entries/TrendingSlider';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { Search } from 'lucide-react';
|
||||
import { EntryCard } from '@/components/entries/EntryCard';
|
||||
|
||||
export function HomePage() {
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [searchInput, setSearchInput] = useState('');
|
||||
const [debouncedQuery, setDebouncedQuery] = useState('');
|
||||
const debounceRef = useRef<ReturnType<typeof setTimeout>>();
|
||||
|
||||
useEffect(() => {
|
||||
if (debounceRef.current) clearTimeout(debounceRef.current);
|
||||
debounceRef.current = setTimeout(() => {
|
||||
setDebouncedQuery(searchInput);
|
||||
}, 400);
|
||||
return () => {
|
||||
if (debounceRef.current) clearTimeout(debounceRef.current);
|
||||
};
|
||||
}, [searchInput]);
|
||||
|
||||
// Pre-load library
|
||||
useLibrary();
|
||||
@@ -16,25 +38,39 @@ export function HomePage() {
|
||||
const trendingTv = useTrendingTv();
|
||||
const popularMovies = usePopularMovies();
|
||||
const popularTv = usePopularTv();
|
||||
const searchResults = useTmdbSearch(searchQuery);
|
||||
const topRatedMovies = useTopRatedMovies();
|
||||
const topRatedTv = useTopRatedTv();
|
||||
const upcomingMovies = useUpcomingMovies();
|
||||
const searchResults = useTmdbSearch(debouncedQuery);
|
||||
|
||||
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 searchEntries = searchResults.data?.pages.flatMap((p) => p.results) ?? [];
|
||||
|
||||
const isSearching = searchQuery.length > 0;
|
||||
const isSearching = debouncedQuery.length > 0;
|
||||
|
||||
return (
|
||||
<div className="space-y-8 animate-page-enter">
|
||||
{/* Trending Slider Hero */}
|
||||
{!isSearching && (
|
||||
<TrendingSlider
|
||||
entries={trendingMovieEntries}
|
||||
isLoading={trendingMovies.isLoading}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Search */}
|
||||
<div className="relative max-w-md">
|
||||
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder="Search movies & TV shows..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
value={searchInput}
|
||||
onChange={(e) => setSearchInput(e.target.value)}
|
||||
className="pl-10"
|
||||
/>
|
||||
</div>
|
||||
@@ -42,7 +78,7 @@ export function HomePage() {
|
||||
{isSearching ? (
|
||||
<div className="space-y-4">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Search Results for "{searchQuery}"
|
||||
Search Results for "{debouncedQuery}"
|
||||
</h2>
|
||||
{searchEntries.length === 0 && !searchResults.isLoading ? (
|
||||
<p className="text-muted-foreground">No results found.</p>
|
||||
@@ -67,7 +103,7 @@ export function HomePage() {
|
||||
movieEntries={trendingMovieEntries}
|
||||
tvEntries={trendingTvEntries}
|
||||
isLoading={trendingMovies.isLoading || trendingTv.isLoading}
|
||||
moreLink="/library"
|
||||
category="trending"
|
||||
/>
|
||||
|
||||
<TrendingGrid
|
||||
@@ -75,7 +111,23 @@ export function HomePage() {
|
||||
movieEntries={popularMovieEntries}
|
||||
tvEntries={popularTvEntries}
|
||||
isLoading={popularMovies.isLoading || popularTv.isLoading}
|
||||
moreLink="/library"
|
||||
category="popular"
|
||||
/>
|
||||
|
||||
<TrendingGrid
|
||||
title="Top Rated"
|
||||
movieEntries={topRatedMovieEntries}
|
||||
tvEntries={topRatedTvEntries}
|
||||
isLoading={topRatedMovies.isLoading || topRatedTv.isLoading}
|
||||
category="top-rated"
|
||||
/>
|
||||
|
||||
<TrendingGrid
|
||||
title="Upcoming"
|
||||
movieEntries={upcomingMovieEntries}
|
||||
tvEntries={[]}
|
||||
isLoading={upcomingMovies.isLoading}
|
||||
category="upcoming"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user