Files
movie-advisor/app/(site)/(root)/container.tsx
T
ner f22f3c45b4 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.
2026-09-24 15:54:40 +03:00

43 lines
1.2 KiB
TypeScript

'use client';
import { FC } from 'react';
import Preview from '@/components/Preview';
import Trending from '@/components/Trending';
import { Skeleton } from '@/components/ui/skeleton';
import Carousel from './components/Carousel';
import useRandomMovie from './useRandomMovie';
interface Props {
page: number;
type: Show['type'];
}
const Container: FC<Props> = ({ page, type }) => {
const { show, shows, onIndexChange, fetchNextPage } = useRandomMovie({ page, type });
return (
<div className='flex flex-1 flex-col'>
<div className='xs:mb-4'>
{show ? (
<Preview
show={show}
className='rounded-md bg-background'
poster={<Carousel key={type} shows={shows} onIndexChange={onIndexChange} onEndReached={fetchNextPage} />}
/>
) : (
<Skeleton className='card-aspect-ratio static-aspect-ratio mx-auto rounded-lg' />
)}
<div className='h-2 w-full' />
</div>
<div className='hidden w-full rounded-lg xs:block'>
<Trending showId={show?.id} showType={show?.type} />
<div className='h-2 w-full' />
</div>
</div>
);
};
export default Container;