feat(Settings): added gamepad support toggle

This commit is contained in:
Botzy 2025-03-24 16:55:07 +02:00
parent 3ef25d0346
commit c97c41f11c
3 changed files with 29 additions and 0 deletions

View file

@ -31,6 +31,7 @@ const Settings = () => {
const toast = useToast();
const {
interfaceLanguageSelect,
gamepadSupportToggle,
hideSpoilersToggle,
subtitlesLanguageSelect,
subtitlesSizeSelect,
@ -352,6 +353,16 @@ const Settings = () => {
{...hideSpoilersToggle}
/>
</div>
<div className={styles['option-container']}>
<div className={styles['option-name-container']}>
<div className={styles['label']}>{ t('SETTINGS_GAMEPAD') }</div>
</div>
<Toggle
className={classnames(styles['option-input-container'], styles['toggle-container'])}
tabIndex={-1}
{...gamepadSupportToggle}
/>
</div>
</div>
<div ref={playerSectionRef} className={styles['section-container']}>
<div className={styles['section-title']}>{ t('SETTINGS_NAV_PLAYER') }</div>

View file

@ -32,6 +32,22 @@ const useProfileSettingsInputs = (profile) => {
}
}), [profile.settings]);
const gamepadSupportToggle = React.useMemo(() => ({
checked: profile.settings.gamepadSupport,
onClick: () => {
core.transport.dispatch({
action: 'Ctx',
args: {
action: 'UpdateSettings',
args: {
...profile.settings,
gamepadSupport: !profile.settings.gamepadSupport
}
}
});
}
}), [profile.settings]);
const hideSpoilersToggle = React.useMemo(() => ({
checked: profile.settings.hideSpoilers,
onClick: () => {
@ -341,6 +357,7 @@ const useProfileSettingsInputs = (profile) => {
}), [profile.settings]);
return {
interfaceLanguageSelect,
gamepadSupportToggle,
hideSpoilersToggle,
subtitlesLanguageSelect,
subtitlesSizeSelect,

View file

@ -22,6 +22,7 @@ type Settings = {
escExitFullscreen: boolean,
interfaceLanguage: string,
hideSpoilers: boolean,
gamepadSupport: boolean,
nextVideoNotificationDuration: number,
playInBackground: boolean,
playerType: string | null,