import { Text } from "@/components/common/Text"; import MoviePoster from "@/components/posters/MoviePoster"; import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; import { View, ViewProps } from "react-native"; import ContinueWatchingPoster from "../ContinueWatchingPoster"; import { ItemCardText } from "../ItemCardText"; import { HorizontalScroll } from "../common/HorrizontalScroll"; import { TouchableItemRouter } from "../common/TouchableItemRouter"; import { type QueryKey, useQuery, type QueryFunction, } from "@tanstack/react-query"; import SeriesPoster from "../posters/SeriesPoster"; import { EpisodePoster } from "../posters/EpisodePoster"; interface Props extends ViewProps { title?: string | null; orientation?: "horizontal" | "vertical"; height?: "small" | "large"; disabled?: boolean; queryKey: QueryKey; queryFn: QueryFunction; } export const ScrollingCollectionList: React.FC = ({ title, orientation = "vertical", height = "small", disabled = false, queryFn, queryKey, ...props }) => { const { data, isLoading } = useQuery({ queryKey, queryFn, enabled: !disabled, staleTime: 60 * 1000, }); if (disabled || !title) return null; return ( {title} data={data} height={orientation === "vertical" ? 247 : 164} loading={isLoading} renderItem={(item, index) => ( {item.Type === "Episode" && orientation === "horizontal" && ( )} {item.Type === "Episode" && orientation === "vertical" && ( )} {item.Type === "Movie" && orientation === "horizontal" && ( )} {item.Type === "Movie" && orientation === "vertical" && ( )} {item.Type === "Series" && } )} /> ); };