mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-24 15:17:41 +01:00
21 lines
609 B
TypeScript
21 lines
609 B
TypeScript
import { MWMediaMeta } from "providers";
|
|
import { useWatchedContext, getWatchedFromPortable } from "state/watched";
|
|
import { MediaCard } from "./MediaCard";
|
|
|
|
export interface WatchedMediaCardProps {
|
|
media: MWMediaMeta;
|
|
}
|
|
|
|
export function WatchedMediaCard(props: WatchedMediaCardProps) {
|
|
const { watched } = useWatchedContext();
|
|
const foundWatched = getWatchedFromPortable(watched.items, props.media);
|
|
const watchedPercentage = (foundWatched && foundWatched.percentage) || 0;
|
|
|
|
return (
|
|
<MediaCard
|
|
watchedPercentage={watchedPercentage}
|
|
media={props.media}
|
|
linkable
|
|
/>
|
|
);
|
|
}
|