mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-21 10:42:18 +00:00
hide recommended if there is no progress
This commit is contained in:
parent
49beea82b6
commit
2b9680313c
1 changed files with 31 additions and 18 deletions
|
|
@ -4,6 +4,7 @@ import { WideContainer } from "@/components/layout/WideContainer";
|
||||||
import { DetailsModal } from "@/components/overlays/details/DetailsModal";
|
import { DetailsModal } from "@/components/overlays/details/DetailsModal";
|
||||||
import { useModal } from "@/components/overlays/Modal";
|
import { useModal } from "@/components/overlays/Modal";
|
||||||
import { useDiscoverStore } from "@/stores/discover";
|
import { useDiscoverStore } from "@/stores/discover";
|
||||||
|
import { useProgressStore } from "@/stores/progress";
|
||||||
import { MediaItem } from "@/utils/mediaTypes";
|
import { MediaItem } from "@/utils/mediaTypes";
|
||||||
|
|
||||||
import { DiscoverNavigation } from "./components/DiscoverNavigation";
|
import { DiscoverNavigation } from "./components/DiscoverNavigation";
|
||||||
|
|
@ -17,6 +18,7 @@ export function DiscoverContent() {
|
||||||
const [detailsData, setDetailsData] = useState<any>();
|
const [detailsData, setDetailsData] = useState<any>();
|
||||||
const detailsModal = useModal("discover-details");
|
const detailsModal = useModal("discover-details");
|
||||||
const carouselRefs = useRef<{ [key: string]: HTMLDivElement | null }>({});
|
const carouselRefs = useRef<{ [key: string]: HTMLDivElement | null }>({});
|
||||||
|
const progressItems = useProgressStore((state) => state.items);
|
||||||
|
|
||||||
// Only load data for the active tab
|
// Only load data for the active tab
|
||||||
const isMoviesTab = selectedCategory === "movies";
|
const isMoviesTab = selectedCategory === "movies";
|
||||||
|
|
@ -35,19 +37,28 @@ export function DiscoverContent() {
|
||||||
detailsModal.show();
|
detailsModal.show();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const movieProgressItems = Object.entries(progressItems || {}).filter(
|
||||||
|
([_, item]) => item.type === "movie",
|
||||||
|
);
|
||||||
|
const tvProgressItems = Object.entries(progressItems || {}).filter(
|
||||||
|
([_, item]) => item.type === "show",
|
||||||
|
);
|
||||||
|
|
||||||
// Render Movies content with lazy loading
|
// Render Movies content with lazy loading
|
||||||
const renderMoviesContent = () => {
|
const renderMoviesContent = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Movie Recommendations */}
|
{/* Movie Recommendations - only show if there are movie progress items */}
|
||||||
<MediaCarousel
|
{movieProgressItems.length > 0 && (
|
||||||
content={{ type: "recommendations" }}
|
<MediaCarousel
|
||||||
isTVShow={false}
|
content={{ type: "recommendations" }}
|
||||||
carouselRefs={carouselRefs}
|
isTVShow={false}
|
||||||
onShowDetails={handleShowDetails}
|
carouselRefs={carouselRefs}
|
||||||
moreContent
|
onShowDetails={handleShowDetails}
|
||||||
showRecommendations
|
moreContent
|
||||||
/>
|
showRecommendations
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Latest Releases */}
|
{/* Latest Releases */}
|
||||||
<MediaCarousel
|
<MediaCarousel
|
||||||
|
|
@ -103,15 +114,17 @@ export function DiscoverContent() {
|
||||||
const renderTVShowsContent = () => {
|
const renderTVShowsContent = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* TV Show Recommendations */}
|
{/* TV Show Recommendations - only show if there are TV show progress items */}
|
||||||
<MediaCarousel
|
{tvProgressItems.length > 0 && (
|
||||||
content={{ type: "recommendations" }}
|
<MediaCarousel
|
||||||
isTVShow
|
content={{ type: "recommendations" }}
|
||||||
carouselRefs={carouselRefs}
|
isTVShow
|
||||||
onShowDetails={handleShowDetails}
|
carouselRefs={carouselRefs}
|
||||||
moreContent
|
onShowDetails={handleShowDetails}
|
||||||
showRecommendations
|
moreContent
|
||||||
/>
|
showRecommendations
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* On Air */}
|
{/* On Air */}
|
||||||
<MediaCarousel
|
<MediaCarousel
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue