mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
Co-authored-by: lostb1t <coding-mosses0z@icloud.com> Co-authored-by: Fredrik Burmester <fredrik.burmester@gmail.com> Co-authored-by: Gauvain <68083474+Gauvino@users.noreply.github.com> Co-authored-by: Gauvino <uruknarb20@gmail.com> Co-authored-by: storm1er <le.storm1er@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Chris <182387676+whoopsi-daisy@users.noreply.github.com> Co-authored-by: arch-fan <55891793+arch-fan@users.noreply.github.com> Co-authored-by: Alex Kim <alexkim@Alexs-MacBook-Pro.local>
30 lines
856 B
TypeScript
30 lines
856 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
|
|
fillColor={allPlayed ? "primary" : undefined}
|
|
icon={allPlayed ? "checkmark" : "checkmark"}
|
|
onPress={async () => {
|
|
await toggle(!allPlayed);
|
|
}}
|
|
size={props.size}
|
|
/>
|
|
</View>
|
|
);
|
|
};
|