mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 23:59:08 +00:00
Some checks failed
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
63 lines
2.1 KiB
TypeScript
63 lines
2.1 KiB
TypeScript
import type React from "react";
|
|
import { useMemo } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import type { ViewProps } from "react-native";
|
|
import { Stepper } from "@/components/inputs/Stepper";
|
|
import DisabledSetting from "@/components/settings/DisabledSetting";
|
|
import { useSettings } from "@/utils/atoms/settings";
|
|
import { ListGroup } from "../list/ListGroup";
|
|
import { ListItem } from "../list/ListItem";
|
|
|
|
interface Props extends ViewProps {}
|
|
|
|
export const MediaToggles: React.FC<Props> = ({ ...props }) => {
|
|
const { t } = useTranslation();
|
|
|
|
const [settings, updateSettings, pluginSettings] = useSettings();
|
|
|
|
const disabled = useMemo(
|
|
() =>
|
|
pluginSettings?.forwardSkipTime?.locked === true &&
|
|
pluginSettings?.rewindSkipTime?.locked === true,
|
|
[pluginSettings],
|
|
);
|
|
|
|
if (!settings) return null;
|
|
|
|
return (
|
|
<DisabledSetting disabled={disabled} {...props}>
|
|
<ListGroup title={t("home.settings.media_controls.media_controls_title")}>
|
|
<ListItem
|
|
title={t("home.settings.media_controls.forward_skip_length")}
|
|
disabled={pluginSettings?.forwardSkipTime?.locked}
|
|
>
|
|
<Stepper
|
|
value={settings.forwardSkipTime}
|
|
disabled={pluginSettings?.forwardSkipTime?.locked}
|
|
step={5}
|
|
appendValue={t("home.settings.media_controls.seconds_unit")}
|
|
min={0}
|
|
max={60}
|
|
onUpdate={(forwardSkipTime) => updateSettings({ forwardSkipTime })}
|
|
/>
|
|
</ListItem>
|
|
|
|
<ListItem
|
|
title={t("home.settings.media_controls.rewind_length")}
|
|
disabled={pluginSettings?.rewindSkipTime?.locked}
|
|
>
|
|
<Stepper
|
|
value={settings.rewindSkipTime}
|
|
disabled={pluginSettings?.rewindSkipTime?.locked}
|
|
step={5}
|
|
appendValue={t("home.settings.media_controls.seconds_unit")}
|
|
min={0}
|
|
max={60}
|
|
onUpdate={(rewindSkipTime) => updateSettings({ rewindSkipTime })}
|
|
/>
|
|
</ListItem>
|
|
</ListGroup>
|
|
</DisabledSetting>
|
|
);
|
|
};
|