From 9b2185d29e3ecfdd42c783969e3353d6f1d76bce Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sun, 25 Aug 2024 20:47:57 +0200 Subject: [PATCH] fix: posters --- components/ContinueWatchingPoster.tsx | 15 +++++++-------- components/home/ScrollingCollectionList.tsx | 7 ++++++- components/posters/MoviePoster.tsx | 3 --- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/components/ContinueWatchingPoster.tsx b/components/ContinueWatchingPoster.tsx index 20acb45b..a28bc706 100644 --- a/components/ContinueWatchingPoster.tsx +++ b/components/ContinueWatchingPoster.tsx @@ -5,9 +5,6 @@ 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; @@ -20,11 +17,13 @@ const ContinueWatchingPoster: React.FC = ({ }) => { const [api] = useAtom(apiAtom); - const url = useMemo( - () => - `${api?.basePath}/Items/${item.ParentBackdropItemId}/Images/Thumb?fillHeight=389&quality=80&tag=${item.ParentThumbImageTag}`, - [item] - ); + const url = useMemo(() => { + if (!api) return; + if (item.Type === "Episode") + return `${api?.basePath}/Items/${item.ParentBackdropItemId}/Images/Thumb?fillHeight=389&quality=80&tag=${item.ParentThumbImageTag}`; + if (item.Type === "Movie") + return `${api?.basePath}/Items/${item.Id}/Images/Thumb?fillHeight=389&quality=80&tag=${item.ImageTags?.["Thumb"]}`; + }, [item]); const [progress, setProgress] = useState( item.UserData?.PlayedPercentage || 0 diff --git a/components/home/ScrollingCollectionList.tsx b/components/home/ScrollingCollectionList.tsx index 502f54bf..32628690 100644 --- a/components/home/ScrollingCollectionList.tsx +++ b/components/home/ScrollingCollectionList.tsx @@ -65,7 +65,12 @@ export const ScrollingCollectionList: React.FC = ({ {item.Type === "Episode" && orientation === "vertical" && ( )} - {item.Type === "Movie" && } + {item.Type === "Movie" && orientation === "horizontal" && ( + + )} + {item.Type === "Movie" && orientation === "vertical" && ( + + )} {item.Type === "Series" && } diff --git a/components/posters/MoviePoster.tsx b/components/posters/MoviePoster.tsx index 5484ecb1..056e2c30 100644 --- a/components/posters/MoviePoster.tsx +++ b/components/posters/MoviePoster.tsx @@ -19,9 +19,6 @@ const MoviePoster: React.FC = ({ const [api] = useAtom(apiAtom); const url = useMemo(() => { - if (item.Type === "Episode") { - return `${api?.basePath}/Items/${item.ParentBackdropItemId}/Images/Thumb?fillHeight=389&quality=80&tag=${item.ParentThumbImageTag}`; - } return getPrimaryImageUrl({ api, item,