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
@@ -130,8 +130,11 @@ function EpisodeCalendarItem({ episode }: { episode: Episode }) {
|
||||
const entryId = entry?.id;
|
||||
const entryTitle = entry?.title ?? '';
|
||||
const seasonId = episode.season_id;
|
||||
const seasonNumber = episode.season?.season_number ?? null;
|
||||
|
||||
const seasonLabel = `S${String(seasonId).padStart(2, '0')}`;
|
||||
const seasonLabel = seasonNumber != null
|
||||
? `S${String(seasonNumber).padStart(2, '0')}`
|
||||
: '';
|
||||
const episodeLabel = `E${String(episode.episode_number).padStart(2, '0')}`;
|
||||
|
||||
const thumbSrc = episode.still_path
|
||||
|
||||
@@ -12,6 +12,8 @@ import { WatchTimeChart } from '@/components/dashboard/WatchTimeChart';
|
||||
import { RatingsChart } from '@/components/dashboard/RatingsChart';
|
||||
import { TopGenresChart } from '@/components/dashboard/TopGenresChart';
|
||||
import { CouchDayChart } from '@/components/dashboard/CouchDayChart';
|
||||
import { LibraryGrowthChart } from '@/components/dashboard/LibraryGrowthChart';
|
||||
import { MediaTypeChart } from '@/components/dashboard/MediaTypeChart';
|
||||
|
||||
export function DashboardPage() {
|
||||
useLibrary();
|
||||
@@ -51,8 +53,8 @@ export function DashboardPage() {
|
||||
},
|
||||
{
|
||||
title: 'Watch Time',
|
||||
value: stats?.totalWatchTime
|
||||
? formatRuntime(stats.totalWatchTime)
|
||||
value: stats
|
||||
? formatRuntime((parseInt(stats.series || '0') || 0) + (parseInt(stats.movies || '0') || 0))
|
||||
: '0h',
|
||||
icon: Clock,
|
||||
color: 'text-orange-500',
|
||||
@@ -91,7 +93,11 @@ export function DashboardPage() {
|
||||
<RatingsChart />
|
||||
<TopGenresChart />
|
||||
</div>
|
||||
<CouchDayChart />
|
||||
<div className="grid gap-4 lg:grid-cols-2">
|
||||
<CouchDayChart />
|
||||
<MediaTypeChart />
|
||||
</div>
|
||||
<LibraryGrowthChart />
|
||||
|
||||
{/* Recently Watched */}
|
||||
<div className="space-y-4">
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useInfiniteQuery } from '@tanstack/react-query';
|
||||
import { tmdbApi } from '@/api/tmdb';
|
||||
import { useLibrary } from '@/hooks/useEntries';
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { EntryCard, EntryCardSkeleton } from '@/components/entries/EntryCard';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import type { TmdbEntry, TmdbPaginatedResponse } from '@/types';
|
||||
|
||||
const CATEGORY_LABELS: Record<string, string> = {
|
||||
trending: 'Trending',
|
||||
popular: 'Popular',
|
||||
'top-rated': 'Top Rated',
|
||||
upcoming: 'Upcoming',
|
||||
};
|
||||
|
||||
type MediaTab = 'movie' | 'tv';
|
||||
|
||||
function useCategoryQuery(category: string, mediaType: MediaTab) {
|
||||
return useInfiniteQuery<TmdbPaginatedResponse<TmdbEntry>>({
|
||||
queryKey: ['tmdb', category, mediaType],
|
||||
queryFn: ({ pageParam }) => {
|
||||
const page = pageParam as number;
|
||||
switch (category) {
|
||||
case 'trending':
|
||||
return mediaType === 'movie'
|
||||
? tmdbApi.getTrendingMovies(page)
|
||||
: tmdbApi.getTrendingTv(page);
|
||||
case 'popular':
|
||||
return mediaType === 'movie'
|
||||
? tmdbApi.getPopularMovies(page)
|
||||
: tmdbApi.getPopularTv(page);
|
||||
case 'top-rated':
|
||||
return mediaType === 'movie'
|
||||
? tmdbApi.getTopRatedMovies(page)
|
||||
: tmdbApi.getTopRatedTv(page);
|
||||
case 'upcoming':
|
||||
return tmdbApi.getUpcomingMovies(page);
|
||||
default:
|
||||
return tmdbApi.getPopularMovies(page);
|
||||
}
|
||||
},
|
||||
initialPageParam: 1,
|
||||
getNextPageParam: (lastPage) =>
|
||||
lastPage.page < lastPage.total_pages ? lastPage.page + 1 : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
export function DiscoverPage() {
|
||||
const { category = 'trending' } = useParams<{ category: string }>();
|
||||
const [mediaType, setMediaType] = useState<MediaTab>('movie');
|
||||
const sentinelRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useLibrary();
|
||||
|
||||
const isUpcoming = category === 'upcoming';
|
||||
const query = useCategoryQuery(category, mediaType);
|
||||
const entries = query.data?.pages.flatMap((p) => p.results) ?? [];
|
||||
|
||||
// Infinite scroll via IntersectionObserver
|
||||
const handleIntersect = useCallback(
|
||||
(entries: IntersectionObserverEntry[]) => {
|
||||
if (entries[0]?.isIntersecting && query.hasNextPage && !query.isFetchingNextPage) {
|
||||
query.fetchNextPage();
|
||||
}
|
||||
},
|
||||
[query.hasNextPage, query.isFetchingNextPage, query.fetchNextPage],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const el = sentinelRef.current;
|
||||
if (!el) return;
|
||||
const observer = new IntersectionObserver(handleIntersect, { rootMargin: '400px' });
|
||||
observer.observe(el);
|
||||
return () => observer.disconnect();
|
||||
}, [handleIntersect]);
|
||||
|
||||
const title = CATEGORY_LABELS[category] || 'Discover';
|
||||
|
||||
return (
|
||||
<div className="space-y-6 animate-page-enter">
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-2xl font-bold">{title}</h1>
|
||||
{!isUpcoming && (
|
||||
<Tabs
|
||||
value={mediaType}
|
||||
onValueChange={(v) => setMediaType(v as MediaTab)}
|
||||
>
|
||||
<TabsList className="h-8">
|
||||
<TabsTrigger value="movie" className="text-xs px-3">
|
||||
Movies
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="tv" className="text-xs px-3">
|
||||
TV Series
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{query.isLoading ? (
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||
{Array.from({ length: 21 }).map((_, i) => (
|
||||
<EntryCardSkeleton key={i} />
|
||||
))}
|
||||
</div>
|
||||
) : entries.length === 0 ? (
|
||||
<p className="text-muted-foreground">No results found.</p>
|
||||
) : (
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||
{entries.map((entry, index) => (
|
||||
<div
|
||||
key={`${entry.id}-${index}`}
|
||||
className="animate-card-enter"
|
||||
style={{ animationDelay: `${Math.min(index * 20, 300)}ms` }}
|
||||
>
|
||||
<EntryCard tmdbEntry={entry} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Infinite scroll sentinel */}
|
||||
<div ref={sentinelRef} className="flex justify-center py-4">
|
||||
{query.isFetchingNextPage && (
|
||||
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -107,80 +107,91 @@ export function EntryDetailsPage() {
|
||||
|
||||
{/* Main content */}
|
||||
<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">
|
||||
<MoreHorizontal className="h-4 w-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-56">
|
||||
<DropdownMenuItem onClick={() => setShowRatingDialog(true)}>
|
||||
<Star className="mr-2 h-4 w-4" />
|
||||
Rate this
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
updateEntry.mutate({ id: e.id, data: { hidden: !e.hidden } })
|
||||
}
|
||||
>
|
||||
<EyeOff className="mr-2 h-4 w-4" />
|
||||
{e.hidden ? 'Unhide' : 'Hide'}
|
||||
</DropdownMenuItem>
|
||||
<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
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setShowSettings(true)}>
|
||||
<Settings className="mr-2 h-4 w-4" />
|
||||
Settings
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
|
||||
{/* Two-column header: sticky poster | info */}
|
||||
<div className="flex flex-col gap-6 -mt-16 relative items-start sm:flex-row sm:gap-8 sm:-mt-24">
|
||||
{/* LEFT: Sticky poster + actions */}
|
||||
<div className="sm:sticky sm:top-20 w-32 sm:w-44 shrink-0 space-y-3 self-start mx-auto sm:mx-0">
|
||||
<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="flex flex-col gap-2">
|
||||
<Button
|
||||
variant={e.favorit ? 'default' : 'outline'}
|
||||
size="sm"
|
||||
className="w-full justify-start"
|
||||
onClick={toggleFavorite}
|
||||
disabled={updateEntry.isPending}
|
||||
>
|
||||
{updateEntry.isPending ? (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<Heart className={`mr-2 h-4 w-4 ${e.favorit ? 'fill-current' : ''}`} />
|
||||
)}
|
||||
{e.favorit ? 'Favorited' : 'Favorite'}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="w-full justify-start"
|
||||
onClick={() => setShowSeenDialog(true)}
|
||||
>
|
||||
<Eye className="mr-2 h-4 w-4" />
|
||||
Mark Watched
|
||||
</Button>
|
||||
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="sm" className="w-full justify-start">
|
||||
<MoreHorizontal className="mr-2 h-4 w-4" />
|
||||
More actions
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" side="right" className="w-56">
|
||||
<DropdownMenuItem onClick={() => setShowRatingDialog(true)}>
|
||||
<Star className="mr-2 h-4 w-4" />
|
||||
Rate this
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() =>
|
||||
updateEntry.mutate({ id: e.id, data: { hidden: !e.hidden } })
|
||||
}
|
||||
>
|
||||
<EyeOff className="mr-2 h-4 w-4" />
|
||||
{e.hidden ? 'Unhide' : 'Hide'}
|
||||
</DropdownMenuItem>
|
||||
<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
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setShowSettings(true)}>
|
||||
<Settings className="mr-2 h-4 w-4" />
|
||||
Settings
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* RIGHT: Entry info */}
|
||||
|
||||
@@ -196,7 +196,7 @@ export function EpisodePage() {
|
||||
variant="destructive"
|
||||
onConfirm={() => {
|
||||
if (deleteTarget !== null) {
|
||||
deleteEpisodeSeen.mutate({ id: deleteTarget, entryId: entryIdNum, episodeId: epId });
|
||||
deleteEpisodeSeen.mutate({ id: deleteTarget, entryId: entryIdNum, episodeId: epId, seasonId: parseInt(seasonId!, 10) });
|
||||
setDeleteTarget(null);
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -80,15 +80,15 @@ export function LibraryPage() {
|
||||
const baseEntries = useMemo(() => {
|
||||
switch (activeTab) {
|
||||
case 'movies':
|
||||
return allEntries.filter((e) => !e.is_tvseries && !e.watchlist);
|
||||
return allEntries.filter((e) => !e.is_tvseries && !e.watchlist && !e.hidden);
|
||||
case 'tv':
|
||||
return allEntries.filter((e) => e.is_tvseries && !e.watchlist);
|
||||
return allEntries.filter((e) => e.is_tvseries && !e.watchlist && !e.hidden);
|
||||
case 'favorites':
|
||||
return allEntries.filter((e) => e.favorit && !e.watchlist);
|
||||
return allEntries.filter((e) => e.favorit && !e.watchlist && !e.hidden);
|
||||
case 'hidden':
|
||||
return allEntries.filter((e) => e.hidden);
|
||||
default:
|
||||
return allEntries.filter((e) => !e.watchlist);
|
||||
return allEntries.filter((e) => !e.watchlist && !e.hidden);
|
||||
}
|
||||
}, [activeTab, allEntries]);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useParams, Link } from 'react-router-dom';
|
||||
import { useSeason, useSeasonEpisodes } from '@/hooks/useSeasons';
|
||||
import { useCreateEpisodeSeen } from '@/hooks/useEpisodeSeen';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Progress } from '@/components/ui/progress';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -14,6 +15,7 @@ export function SeasonPage() {
|
||||
}>();
|
||||
const { data: season, isLoading } = useSeason(parseInt(seasonId!, 10));
|
||||
const { data: episodes = [] } = useSeasonEpisodes(parseInt(seasonId!, 10));
|
||||
const createEpisodeSeen = useCreateEpisodeSeen();
|
||||
|
||||
if (isLoading || !season) {
|
||||
return (
|
||||
@@ -141,8 +143,15 @@ export function SeasonPage() {
|
||||
onClick={(ev) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
// TODO: Mark episode as watched
|
||||
if (!isWatched) {
|
||||
createEpisodeSeen.mutate({
|
||||
entry_id: parseInt(entryId!, 10),
|
||||
episode_id: episode.id,
|
||||
date_seen: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
}}
|
||||
disabled={isWatched || createEpisodeSeen.isPending}
|
||||
>
|
||||
<Eye className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user