mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
Some checks failed
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { type BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
|
|
import { useState } from "react";
|
|
import { View, type ViewProps } from "react-native";
|
|
import { ItemImage } from "../common/ItemImage";
|
|
import { WatchedIndicator } from "../WatchedIndicator";
|
|
|
|
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'
|
|
{...props}
|
|
>
|
|
<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>
|
|
);
|
|
|
|
return (
|
|
<View
|
|
className='rounded-lg w-full aspect-square overflow-hidden border border-neutral-900'
|
|
{...props}
|
|
>
|
|
<ItemImage className='w-full aspect-square' item={item} />
|
|
</View>
|
|
);
|
|
};
|