2022-02-28 00:08:20 +01:00
|
|
|
import { MWMediaMeta } from "providers";
|
2022-02-18 21:11:23 +01:00
|
|
|
import { useWatchedContext, getWatchedFromPortable } from "state/watched";
|
2022-02-07 23:22:35 +01:00
|
|
|
import { MediaCard } from "./MediaCard";
|
|
|
|
|
|
|
|
export interface WatchedMediaCardProps {
|
2022-02-28 00:08:20 +01:00
|
|
|
media: MWMediaMeta;
|
2022-02-07 23:22:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export function WatchedMediaCard(props: WatchedMediaCardProps) {
|
2022-02-18 21:11:23 +01:00
|
|
|
const { watched } = useWatchedContext();
|
|
|
|
const foundWatched = getWatchedFromPortable(watched, props.media);
|
|
|
|
const watchedPercentage = (foundWatched && foundWatched.percentage) || 0;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<MediaCard
|
|
|
|
watchedPercentage={watchedPercentage}
|
|
|
|
media={props.media}
|
|
|
|
linkable
|
|
|
|
/>
|
|
|
|
);
|
2022-02-07 23:22:35 +01:00
|
|
|
}
|