mirror of
https://github.com/p-stream/p-stream.git
synced 2026-05-04 12:59:16 +00:00
add top 10 list
This commit is contained in:
parent
dcbf21f3f9
commit
49e1423a0e
6 changed files with 42 additions and 11 deletions
|
|
@ -1442,7 +1442,8 @@
|
||||||
"genreMovies": "{{genre}} Movies",
|
"genreMovies": "{{genre}} Movies",
|
||||||
"genreShows": "{{genre}} Shows",
|
"genreShows": "{{genre}} Shows",
|
||||||
"categoryMovies": "{{category}} Movies",
|
"categoryMovies": "{{category}} Movies",
|
||||||
"categoryShows": "{{category}} Shows"
|
"categoryShows": "{{category}} Shows",
|
||||||
|
"top10": "Top 10"
|
||||||
},
|
},
|
||||||
"change": "Change",
|
"change": "Change",
|
||||||
"more": "View more"
|
"more": "View more"
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,7 @@ export const getParamountTVShows = () => fetchFromTrakt("/paramounttv");
|
||||||
// Popular content
|
// Popular content
|
||||||
export const getPopularTVShows = () => fetchFromTrakt("/populartv");
|
export const getPopularTVShows = () => fetchFromTrakt("/populartv");
|
||||||
export const getPopularMovies = () => fetchFromTrakt("/popularmovies");
|
export const getPopularMovies = () => fetchFromTrakt("/popularmovies");
|
||||||
|
export const getTop10Movies = () => fetchFromTrakt("/top10");
|
||||||
|
|
||||||
// Discovery content used for the featured carousel
|
// Discovery content used for the featured carousel
|
||||||
export const getDiscoverContent = () =>
|
export const getDiscoverContent = () =>
|
||||||
|
|
|
||||||
|
|
@ -192,16 +192,20 @@ export function MediaCarousel({
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Fetch media using our hook
|
// Fetch media using our hook
|
||||||
const { media, sectionTitle, actualContentType } = useDiscoverMedia({
|
const { media, sectionTitle, actualContentType, error, isLoading } =
|
||||||
contentType,
|
useDiscoverMedia({
|
||||||
mediaType,
|
contentType,
|
||||||
id: selectedProviderId || selectedGenreId || selectedRecommendationId,
|
mediaType,
|
||||||
fallbackType: content.fallback,
|
id: selectedProviderId || selectedGenreId || selectedRecommendationId,
|
||||||
genreName: selectedGenreName,
|
fallbackType: content.fallback,
|
||||||
providerName: selectedProviderName,
|
genreName: selectedGenreName,
|
||||||
mediaTitle: selectedRecommendationTitle,
|
providerName: selectedProviderName,
|
||||||
isCarouselView: true,
|
mediaTitle: selectedRecommendationTitle,
|
||||||
});
|
isCarouselView: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hide section if there's an error or no content (after loading is complete)
|
||||||
|
const shouldHide = !isLoading && (error || media.length === 0);
|
||||||
|
|
||||||
// Find active button
|
// Find active button
|
||||||
const activeButton = React.useMemo(() => {
|
const activeButton = React.useMemo(() => {
|
||||||
|
|
@ -304,6 +308,11 @@ export function MediaCarousel({
|
||||||
actualContentType,
|
actualContentType,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Hide the entire section if there's an error or no content
|
||||||
|
if (shouldHide) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center justify-between ml-2 md:ml-8 mt-2">
|
<div className="flex items-center justify-between ml-2 md:ml-8 mt-2">
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,19 @@ export function DiscoverContent() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Top 10 Movies
|
||||||
|
carousels.push(
|
||||||
|
<LazyMediaCarousel
|
||||||
|
key="movie-top10"
|
||||||
|
content={{ type: "top10" }}
|
||||||
|
isTVShow={false}
|
||||||
|
carouselRefs={carouselRefs}
|
||||||
|
onShowDetails={handleShowDetails}
|
||||||
|
moreContent
|
||||||
|
priority={carousels.length < 2}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
// Latest Releases
|
// Latest Releases
|
||||||
carousels.push(
|
carousels.push(
|
||||||
<LazyMediaCarousel
|
<LazyMediaCarousel
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import {
|
||||||
getParamountTVShows,
|
getParamountTVShows,
|
||||||
getPrimeMovies,
|
getPrimeMovies,
|
||||||
getPrimeTVShows,
|
getPrimeTVShows,
|
||||||
|
getTop10Movies,
|
||||||
} from "@/backend/metadata/traktApi";
|
} from "@/backend/metadata/traktApi";
|
||||||
import { paginateResults } from "@/backend/metadata/traktFunctions";
|
import { paginateResults } from "@/backend/metadata/traktFunctions";
|
||||||
import { TMDBContentTypes } from "@/backend/metadata/types/tmdb";
|
import { TMDBContentTypes } from "@/backend/metadata/types/tmdb";
|
||||||
|
|
@ -481,6 +482,11 @@ export function useDiscoverMedia({
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "top10":
|
||||||
|
data = await fetchTraktMedia(getTop10Movies);
|
||||||
|
setSectionTitle(t("discover.carousel.title.top10"));
|
||||||
|
break;
|
||||||
|
|
||||||
case "latest":
|
case "latest":
|
||||||
data = await fetchTraktMedia(getLatestReleases);
|
data = await fetchTraktMedia(getLatestReleases);
|
||||||
setSectionTitle(t("discover.carousel.title.latestReleases"));
|
setSectionTitle(t("discover.carousel.title.latestReleases"));
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ export type DiscoverContentType =
|
||||||
| "latest"
|
| "latest"
|
||||||
| "latest4k"
|
| "latest4k"
|
||||||
| "latesttv"
|
| "latesttv"
|
||||||
|
| "top10"
|
||||||
| "genre"
|
| "genre"
|
||||||
| "provider"
|
| "provider"
|
||||||
| "editorPicks"
|
| "editorPicks"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue