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

+12 -2
View File
@@ -1,2 +1,12 @@
export const parseShowType = (value: string | string[] | null | undefined): Show['type'] =>
value === 'tv' ? 'tv' : 'movie';
export const SERIES_PREFIX = '/series';
export const isSeriesPath = (pathname: string) =>
pathname === SERIES_PREFIX || pathname.startsWith(`${SERIES_PREFIX}/`);
export const showTypeFromPath = (pathname: string): Show['type'] => (isSeriesPath(pathname) ? 'tv' : 'movie');
export const toShowTypePath = (pathname: string, type: Show['type']) => {
const base = isSeriesPath(pathname) ? pathname.slice(SERIES_PREFIX.length) || '/' : pathname;
return type === 'tv' ? (base === '/' ? SERIES_PREFIX : `${SERIES_PREFIX}${base}`) : base;
};