import { apiAtom } from "@/providers/JellyfinProvider"; import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; import { Image } from "expo-image"; import { useAtom } from "jotai"; import { useMemo, useState } from "react"; import { View } from "react-native"; import { WatchedIndicator } from "./WatchedIndicator"; import { getPrimaryImageUrl } from "@/utils/jellyfin/image/getPrimaryImageUrl"; import { getBackdropUrl } from "@/utils/jellyfin/image/getBackdropUrl"; import { getPrimaryImageUrlById } from "@/utils/jellyfin/image/getPrimaryImageUrlById"; type ContinueWatchingPosterProps = { item: BaseItemDto; width?: number; }; const ContinueWatchingPoster: React.FC = ({ item, width = 176, }) => { const [api] = useAtom(apiAtom); const url = useMemo( () => `${api?.basePath}/Items/${item.ParentBackdropItemId}/Images/Thumb?fillHeight=389&quality=80&tag=${item.ParentThumbImageTag}`, [item] ); const [progress, setProgress] = useState( item.UserData?.PlayedPercentage || 0 ); if (!url) return ( ); return ( {!progress && } {progress > 0 && ( <> )} ); }; export default ContinueWatchingPoster;