Files
streamyfin/components/settings/GestureControls.tsx
Gauvain 2ac664de5a fix(settings): tidy spacing, uniform Android row heights & toggle layout
- spacing: top padding + inter-group gaps so section titles, descriptions
  and buttons no longer touch (playback buffer, audio/subtitles, music,
  marlin, kefin, streamystats, storage, hide-libraries)
- ListGroup: skip empty section titles
- SettingSwitch: cap the native Android switch in a fixed centered box so
  toggle rows match the other rows and stay put when toggled; iOS unchanged
- Appearance: move "Hide libraries" to the end of the list
2026-06-24 22:22:49 +02:00

118 lines
4.2 KiB
TypeScript

import type React from "react";
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import type { ViewProps } from "react-native";
import { SettingSwitch } from "@/components/common/SettingSwitch";
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 GestureControls: React.FC<Props> = ({ ...props }) => {
const { t } = useTranslation();
const { settings, updateSettings, pluginSettings } = useSettings();
const disabled = useMemo(
() =>
pluginSettings?.enableHorizontalSwipeSkip?.locked === true &&
pluginSettings?.enableLeftSideBrightnessSwipe?.locked === true &&
pluginSettings?.enableRightSideVolumeSwipe?.locked === true &&
pluginSettings?.hideVolumeSlider?.locked === true &&
pluginSettings?.hideBrightnessSlider?.locked === true,
[pluginSettings],
);
if (!settings) return null;
return (
<DisabledSetting disabled={disabled} {...props}>
<ListGroup
title={t("home.settings.gesture_controls.gesture_controls_title")}
>
<ListItem
title={t("home.settings.gesture_controls.horizontal_swipe_skip")}
subtitle={t(
"home.settings.gesture_controls.horizontal_swipe_skip_description",
)}
disabled={pluginSettings?.enableHorizontalSwipeSkip?.locked}
>
<SettingSwitch
value={settings.enableHorizontalSwipeSkip}
disabled={pluginSettings?.enableHorizontalSwipeSkip?.locked}
onValueChange={(enableHorizontalSwipeSkip) =>
updateSettings({ enableHorizontalSwipeSkip })
}
/>
</ListItem>
<ListItem
title={t("home.settings.gesture_controls.left_side_brightness")}
subtitle={t(
"home.settings.gesture_controls.left_side_brightness_description",
)}
disabled={pluginSettings?.enableLeftSideBrightnessSwipe?.locked}
>
<SettingSwitch
value={settings.enableLeftSideBrightnessSwipe}
disabled={pluginSettings?.enableLeftSideBrightnessSwipe?.locked}
onValueChange={(enableLeftSideBrightnessSwipe) =>
updateSettings({ enableLeftSideBrightnessSwipe })
}
/>
</ListItem>
<ListItem
title={t("home.settings.gesture_controls.right_side_volume")}
subtitle={t(
"home.settings.gesture_controls.right_side_volume_description",
)}
disabled={pluginSettings?.enableRightSideVolumeSwipe?.locked}
>
<SettingSwitch
value={settings.enableRightSideVolumeSwipe}
disabled={pluginSettings?.enableRightSideVolumeSwipe?.locked}
onValueChange={(enableRightSideVolumeSwipe) =>
updateSettings({ enableRightSideVolumeSwipe })
}
/>
</ListItem>
<ListItem
title={t("home.settings.gesture_controls.hide_volume_slider")}
subtitle={t(
"home.settings.gesture_controls.hide_volume_slider_description",
)}
disabled={pluginSettings?.hideVolumeSlider?.locked}
>
<SettingSwitch
value={settings.hideVolumeSlider}
disabled={pluginSettings?.hideVolumeSlider?.locked}
onValueChange={(hideVolumeSlider) =>
updateSettings({ hideVolumeSlider })
}
/>
</ListItem>
<ListItem
title={t("home.settings.gesture_controls.hide_brightness_slider")}
subtitle={t(
"home.settings.gesture_controls.hide_brightness_slider_description",
)}
disabled={pluginSettings?.hideBrightnessSlider?.locked}
>
<SettingSwitch
value={settings.hideBrightnessSlider}
disabled={pluginSettings?.hideBrightnessSlider?.locked}
onValueChange={(hideBrightnessSlider) =>
updateSettings({ hideBrightnessSlider })
}
/>
</ListItem>
</ListGroup>
</DisabledSetting>
);
};