mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 23:59:08 +00:00
Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com> Co-authored-by: sarendsen <coding-mosses0z@icloud.com> Co-authored-by: Lance Chant <13349722+lancechant@users.noreply.github.com> Co-authored-by: Gauvain <68083474+Gauvino@users.noreply.github.com>
30 lines
849 B
TypeScript
30 lines
849 B
TypeScript
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
|
|
import type React from "react";
|
|
import { View, type ViewProps } from "react-native";
|
|
import { useMarkAsPlayed } from "@/hooks/useMarkAsPlayed";
|
|
import { RoundButton } from "./RoundButton";
|
|
|
|
interface Props extends ViewProps {
|
|
items: BaseItemDto[];
|
|
isOffline?: boolean;
|
|
size?: "default" | "large";
|
|
}
|
|
|
|
export const PlayedStatus: React.FC<Props> = ({ items, ...props }) => {
|
|
const allPlayed = items.every((item) => item.UserData?.Played);
|
|
const toggle = useMarkAsPlayed(items);
|
|
|
|
return (
|
|
<View {...props}>
|
|
<RoundButton
|
|
color={allPlayed ? "purple" : "white"}
|
|
icon={allPlayed ? "checkmark" : "checkmark"}
|
|
onPress={async () => {
|
|
await toggle(!allPlayed);
|
|
}}
|
|
size={props.size}
|
|
/>
|
|
</View>
|
|
);
|
|
};
|