import { useEntryRecommendations } from "@/hooks/useEntries"; import { EntryCard } from "@/components/entries/EntryCard"; import { Skeleton } from "@/components/ui/skeleton"; const GRID = "grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-6"; const MAX_ITEMS = 12; /** "More like this": live TMDB recommendations for a library entry. */ export function RecommendationsSection({ entryId, isTvSeries, }: { entryId: number; isTvSeries: boolean; }) { const { data, isLoading, isError } = useEntryRecommendations(entryId); if (isError) return null; const results = (data?.results ?? []) .filter((r) => r.poster_path) .slice(0, MAX_ITEMS) // Recommendations don't always carry media_type; it matches the entry's .map((r) => ({ ...r, media_type: r.media_type ?? (isTvSeries ? "tv" : "movie"), })); if (!isLoading && results.length === 0) return null; return (

More like this

{isLoading ? Array.from({ length: 6 }).map((_, i) => ( )) : results.map((r) => )}
); }