feat(show-type): path-based /series filter and infinite trending galleries

Persist the show-type filter in the path via a /series prefix: movies
keep bare URLs, series use /series across random, popular, top,
favorites and watchlist. The path is the single source of truth - the
jotai atom is removed and the toggle navigates with router.replace so
the server prefetches the target variant. Legacy ?type=tv deep links
redirect to the prefixed URLs.

Trending and similar/recommendations queries are now paginated and feed
useInfiniteList like the main lists. Gallery wires fetchNextPage to a
new ScrollNavigation onEndReached callback (fires within two slides of
the end, once per approach), so all gallery tabs load more on scroll.
The show page prefetches the first similar page with
prefetchInfiniteQuery, and trending/similar/recommendations are added
to the analytics ListName.
This commit is contained in:
ner committed 2026-09-24 15:54:40 +03:00
1 parent 0824090c6d
commit f22f3c45b4
31 files changed
+372 -229

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import { Metadata } from 'next';
import UsersList from '@/app/(site)/(favorites)/components/UsersLists';
import { TITLE } from '@/env';
export const metadata: Metadata = {
title: `My Favorite Shows | ${TITLE}`,
description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.`,
robots: { index: false }
};
const Favorites = () => (
<>
<h1 className='sr-only'>My Favorite Shows</h1>
<UsersList list='favorite' label='favorites' type='tv' />
</>
);
export default Favorites;
+30
View File
@@ -0,0 +1,30 @@
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
import { Metadata } from 'next';
import Container from '@/app/(site)/(root)/container';
import randomQuery, { generatePage } from '@/data/queries/random';
import { TITLE } from '@/env';
import getQueryClient from '@/lib/queryClient';
export const metadata: Metadata = {
alternates: { canonical: '/series' }
};
const Series = async () => {
const queryClient = getQueryClient();
const page = generatePage('tv');
await queryClient.prefetchInfiniteQuery(randomQuery({ page, type: 'tv' }));
return (
<HydrationBoundary state={dehydrate(queryClient)}>
<h1 className='sr-only'>{TITLE} — Discover Your Next Favorite Series</h1>
<Container page={page} type='tv' />
</HydrationBoundary>
);
};
export const revalidate = 1;
export default Series;
+31
View File
@@ -0,0 +1,31 @@
import { Metadata } from 'next';
import PopularContent from '@/app/(site)/popular/content';
import { TITLE } from '@/env';
const HEADING = 'Popular Series';
const DESCRIPTION = `Check out the most popular series right now on ${TITLE}. See what’s trending and don’t miss out on the latest hits.`;
export const metadata: Metadata = {
title: `${HEADING} | ${TITLE}`,
description: DESCRIPTION,
alternates: { canonical: '/series/popular' },
openGraph: {
type: 'website',
siteName: TITLE,
title: HEADING,
description: DESCRIPTION,
url: '/series/popular'
},
twitter: {
title: HEADING,
description: DESCRIPTION
}
};
const Popular = () => <PopularContent type='tv' />;
export const revalidate = 3600;
export default Popular;
+31
View File
@@ -0,0 +1,31 @@
import { Metadata } from 'next';
import TopContent from '@/app/(site)/top/content';
import { TITLE } from '@/env';
const HEADING = 'Top Rated Series';
const DESCRIPTION = `Discover the top-rated series on ${TITLE}. Find the highest-rated shows and make informed viewing choices.`;
export const metadata: Metadata = {
title: `${HEADING} | ${TITLE}`,
description: DESCRIPTION,
alternates: { canonical: '/series/top' },
openGraph: {
type: 'website',
siteName: TITLE,
title: HEADING,
description: DESCRIPTION,
url: '/series/top'
},
twitter: {
title: HEADING,
description: DESCRIPTION
}
};
const Top = () => <TopContent type='tv' />;
export const revalidate = 3600;
export default Top;
+19
View File
@@ -0,0 +1,19 @@
import { Metadata } from 'next';
import UsersList from '@/app/(site)/(favorites)/components/UsersLists';
import { TITLE } from '@/env';
export const metadata: Metadata = {
title: `My watchlist | ${TITLE}`,
description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.`,
robots: { index: false }
};
const WatchList = () => (
<>
<h1 className='sr-only'>My Watchlist</h1>
<UsersList list='watchlist' label='watchlist' type='tv' />
</>
);
export default WatchList;