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.
42 lines
922 B
TypeScript
42 lines
922 B
TypeScript
import { Metadata } from 'next';
|
|
import { redirect } from 'next/navigation';
|
|
|
|
import { TITLE } from '@/env';
|
|
|
|
import TopContent from './content';
|
|
|
|
const HEADING = 'Top Rated Movies';
|
|
|
|
const DESCRIPTION = `Discover the top-rated movies on ${TITLE}. Find the highest-rated films and make informed viewing choices.`;
|
|
|
|
export const metadata: Metadata = {
|
|
title: `${HEADING} | ${TITLE}`,
|
|
description: DESCRIPTION,
|
|
alternates: { canonical: '/top' },
|
|
openGraph: {
|
|
type: 'website',
|
|
siteName: TITLE,
|
|
title: HEADING,
|
|
description: DESCRIPTION,
|
|
url: '/top'
|
|
},
|
|
twitter: {
|
|
title: HEADING,
|
|
description: DESCRIPTION
|
|
}
|
|
};
|
|
|
|
interface SearchParams {
|
|
type?: string;
|
|
}
|
|
|
|
const Top = async ({ searchParams }: { searchParams: SearchParams }) => {
|
|
if (searchParams.type === 'tv') redirect('/series/top');
|
|
|
|
return <TopContent type='movie' />;
|
|
};
|
|
|
|
export const revalidate = 3600;
|
|
|
|
export default Top;
|