This commit is contained in:
Fredrik Burmester
2024-09-01 17:10:33 +02:00
parent ffea51ccb0
commit 3d73f604ac
5 changed files with 88 additions and 10 deletions

View File

@@ -0,0 +1,47 @@
import { View, ViewProps } from "react-native";
import { Text } from "@/components/common/Text";
import {
BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client/models";
import { ItemImage } from "../common/ItemImage";
import { WatchedIndicator } from "../WatchedIndicator";
import { useState } from "react";
interface Props extends ViewProps {
item: BaseItemDto;
showProgress?: boolean;
}
export const ItemPoster: React.FC<Props> = ({
item,
showProgress,
...props
}) => {
const [progress, setProgress] = useState(
item.UserData?.PlayedPercentage || 0
);
if (item.Type === "Movie" || item.Type === "Series" || item.Type === "BoxSet")
return (
<View className="relative rounded-lg overflow-hidden border border-neutral-900">
<ItemImage
style={{
aspectRatio: "10/15",
width: "100%",
}}
item={item}
/>
<WatchedIndicator item={item} />
{showProgress && progress > 0 && (
<View className="h-1 bg-red-600 w-full"></View>
)}
</View>
);
return (
<View className="rounded-lg w-full aspect-square overflow-hidden border border-neutral-900">
<ItemImage className="w-full aspect-square" item={item} />
</View>
);
};