1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-25 15:27:40 +01:00
smov/src/components/media/WatchedMediaCard.tsx

22 lines
595 B
TypeScript
Raw Normal View History

2022-02-17 18:36:39 +01:00
import { MWMedia } from "providers";
import { useWatchedContext, getWatchedFromPortable } from "state/watched";
2022-02-07 23:22:35 +01:00
import { MediaCard } from "./MediaCard";
export interface WatchedMediaCardProps {
media: MWMedia;
}
export function WatchedMediaCard(props: WatchedMediaCardProps) {
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
}