fix: posters

This commit is contained in:
Fredrik Burmester
2024-08-25 20:47:57 +02:00
parent 67af14dced
commit 9b2185d29e
3 changed files with 13 additions and 12 deletions

View File

@@ -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<ContinueWatchingPosterProps> = ({
}) => {
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

View File

@@ -65,7 +65,12 @@ export const ScrollingCollectionList: React.FC<Props> = ({
{item.Type === "Episode" && orientation === "vertical" && (
<SeriesPoster item={item} />
)}
{item.Type === "Movie" && <MoviePoster item={item} />}
{item.Type === "Movie" && orientation === "horizontal" && (
<ContinueWatchingPoster item={item} />
)}
{item.Type === "Movie" && orientation === "vertical" && (
<MoviePoster item={item} />
)}
{item.Type === "Series" && <SeriesPoster item={item} />}
<ItemCardText item={item} />
</View>

View File

@@ -19,9 +19,6 @@ const MoviePoster: React.FC<MoviePosterProps> = ({
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,