Fix checkboxes to use event handler value

This commit is contained in:
jeffvli
2021-10-25 13:39:38 -07:00
parent b9ae6df676
commit b4faf8dda1
8 changed files with 40 additions and 46 deletions

View File

@@ -231,15 +231,12 @@ const NowPlayingMiniView = () => {
<StyledCheckbox
defaultChecked={playQueue.scrollWithCurrentSong}
checked={playQueue.scrollWithCurrentSong}
onChange={() => {
settings.setSync(
'scrollWithCurrentSong',
!settings.getSync('scrollWithCurrentSong')
);
onChange={(_v: any, e: boolean) => {
settings.setSync('scrollWithCurrentSong', e);
dispatch(
setPlaybackSetting({
setting: 'scrollWithCurrentSong',
value: !playQueue.scrollWithCurrentSong,
value: e,
})
);
}}

View File

@@ -385,15 +385,12 @@ const NowPlayingView = () => {
<StyledCheckbox
defaultChecked={playQueue.scrollWithCurrentSong}
checked={playQueue.scrollWithCurrentSong}
onChange={() => {
settings.setSync(
'scrollWithCurrentSong',
!settings.getSync('scrollWithCurrentSong')
);
onChange={(_v: any, e: boolean) => {
settings.setSync('scrollWithCurrentSong', e);
dispatch(
setPlaybackSetting({
setting: 'scrollWithCurrentSong',
value: !playQueue.scrollWithCurrentSong,
value: e,
})
);
}}

View File

@@ -433,7 +433,7 @@ const PlaylistView = ({ ...rest }) => {
<StyledCheckbox
defaultChecked={editPublic}
value={editPublic}
onChange={() => setEditPublic(!editPublic)}
onChange={(_v: any, e: boolean) => setEditPublic(e)}
>
Public
</StyledCheckbox>

View File

@@ -171,9 +171,9 @@ const CacheConfig = () => {
<div style={{ width: '300px', marginTop: '20px' }}>
<StyledCheckbox
defaultChecked={cacheSongs}
onChange={() => {
settings.setSync('cacheSongs', !settings.getSync('cacheSongs'));
setCacheSongs(!cacheSongs);
onChange={(_v: any, e: boolean) => {
settings.setSync('cacheSongs', e);
setCacheSongs(e);
}}
>
Songs{' '}
@@ -183,9 +183,9 @@ const CacheConfig = () => {
</StyledCheckbox>
<StyledCheckbox
defaultChecked={cacheImages}
onChange={() => {
settings.setSync('cacheImages', !settings.getSync('cacheImages'));
setCacheImages(!cacheImages);
onChange={(_v: any, e: boolean) => {
settings.setSync('cacheImages', e);
setCacheImages(e);
}}
>
Images{' '}

View File

@@ -14,15 +14,15 @@ const DebugConfig = () => {
<ConfigPanel header="Advanced" bordered>
<StyledCheckbox
defaultChecked={showDebugWindow}
onChange={() => {
settings.setSync('showDebugWindow', !settings.getSync('showDebugWindow'));
onChange={(_v: any, e: boolean) => {
settings.setSync('showDebugWindow', e);
dispatch(
setPlaybackSetting({
setting: 'showDebugWindow',
value: settings.getSync('showDebugWindow'),
value: e,
})
);
setShowDebugWindow(!showDebugWindow);
setShowDebugWindow(e);
}}
>
Show debug window

View File

@@ -76,10 +76,10 @@ const LookAndFeelConfig = () => {
<StyledCheckbox
defaultChecked={dynamicBackgroundChk}
checked={dynamicBackgroundChk}
onChange={() => {
settings.setSync('dynamicBackground', !dynamicBackgroundChk);
dispatch(setDynamicBackground(!dynamicBackgroundChk));
setDynamicBackgroundChk(!dynamicBackgroundChk);
onChange={(_v: any, e: boolean) => {
settings.setSync('dynamicBackground', e);
dispatch(setDynamicBackground(e));
setDynamicBackgroundChk(e);
}}
>
Enable dynamic background
@@ -128,15 +128,15 @@ const LookAndFeelConfig = () => {
<StyledCheckbox
defaultChecked={highlightOnRowHoverChk}
checked={highlightOnRowHoverChk}
onChange={() => {
settings.setSync('highlightOnRowHover', !highlightOnRowHoverChk);
onChange={(_v: any, e: boolean) => {
settings.setSync('highlightOnRowHover', e);
dispatch(
setMiscSetting({
setting: 'highlightOnRowHover',
value: !highlightOnRowHoverChk,
value: e,
})
);
setHighlightOnRowHoverChk(!highlightOnRowHoverChk);
setHighlightOnRowHoverChk(e);
}}
>
Show highlight on row hover
@@ -145,8 +145,8 @@ const LookAndFeelConfig = () => {
<p>Select the columns you want displayed on pages with a list-view.</p>
<StyledCheckbox
defaultChecked={resizableColumn}
onChange={() => {
setResizableColumn(!resizableColumn);
onChange={(_v: any, e: boolean) => {
setResizableColumn(e);
}}
>
Use resizable columns (check/uncheck this before selecting columns)

View File

@@ -45,19 +45,19 @@ const PlayerConfig = () => {
<br />
<StyledCheckbox
defaultChecked={globalMediaHotkeys}
onChange={() => {
settings.setSync('globalMediaHotkeys', !settings.getSync('globalMediaHotkeys'));
setGlobalMediaHotkeys(!globalMediaHotkeys);
onChange={(_v: any, e: boolean) => {
settings.setSync('globalMediaHotkeys', e);
setGlobalMediaHotkeys(e);
}}
>
Enable global media hotkeys (requires app restart)
</StyledCheckbox>
<StyledCheckbox
defaultChecked={scrobble}
onChange={() => {
settings.setSync('scrobble', !scrobble);
dispatch(setPlaybackSetting({ setting: 'scrobble', value: !scrobble }));
setScrobble(!scrobble);
onChange={(_v: any, e: boolean) => {
settings.setSync('scrobble', e);
dispatch(setPlaybackSetting({ setting: 'scrobble', value: e }));
setScrobble(e);
}}
>
Enable scrobbling

View File

@@ -12,9 +12,9 @@ const WindowConfig = () => {
<StyledCheckbox
defaultChecked={minimizeToTray}
checked={minimizeToTray}
onChange={() => {
settings.setSync('minimizeToTray', !settings.getSync('minimizeToTray'));
setMinimizeToTray(!minimizeToTray);
onChange={(_v: any, e: boolean) => {
settings.setSync('minimizeToTray', e);
setMinimizeToTray(e);
}}
>
Minimize to tray
@@ -23,9 +23,9 @@ const WindowConfig = () => {
<StyledCheckbox
defaultChecked={exitToTray}
checked={exitToTray}
onChange={() => {
settings.setSync('exitToTray', !settings.getSync('exitToTray'));
setExitToTray(!exitToTray);
onChange={(_v: any, e: boolean) => {
settings.setSync('exitToTray', e);
setExitToTray(e);
}}
>
Exit to tray