diff --git a/src/components/player/PlayerBar.tsx b/src/components/player/PlayerBar.tsx index 223c499..750399e 100644 --- a/src/components/player/PlayerBar.tsx +++ b/src/components/player/PlayerBar.tsx @@ -242,11 +242,20 @@ const PlayerBar = () => { }; const handleRepeat = () => { + const currentRepeat = settings.getSync('repeat'); + const newRepeat = + currentRepeat === 'none' + ? 'all' + : currentRepeat === 'all' + ? 'one' + : 'none'; dispatch(toggleRepeat()); + settings.setSync('repeat', newRepeat); }; const handleShuffle = () => { dispatch(toggleShuffle()); + settings.setSync('shuffle', !settings.getSync('shuffle')); }; const handleDisplayQueue = () => { diff --git a/src/components/settings/Config.tsx b/src/components/settings/Config.tsx index aeaae0d..1783588 100644 --- a/src/components/settings/Config.tsx +++ b/src/components/settings/Config.tsx @@ -188,49 +188,6 @@ const Config = () => { }} style={{ width: '150px' }} /> -
- settings.setSync('defaultRepeat', e)} - > - - Repeat (default):{' '} - - All - One - None - - settings.setSync('defaultShuffle', e === 'true')} - > - - Shuffle (default):{' '} - - Enabled - Disabled - - -
diff --git a/src/components/shared/setDefaultSettings.ts b/src/components/shared/setDefaultSettings.ts index c9963f5..e7fef94 100644 --- a/src/components/shared/setDefaultSettings.ts +++ b/src/components/shared/setDefaultSettings.ts @@ -15,12 +15,12 @@ const setDefaultSettings = (force: boolean) => { fs.mkdirSync(getSongCachePath(), { recursive: true }); fs.mkdirSync(getImageCachePath(), { recursive: true }); - if (force || !settings.hasSync('defaultRepeat')) { - settings.setSync('defaultRepeat', 'all'); + if (force || !settings.hasSync('repeat')) { + settings.setSync('repeat', 'all'); } - if (force || !settings.hasSync('defaultShuffle')) { - settings.setSync('defaultShuffle', false); + if (force || !settings.hasSync('shuffle')) { + settings.setSync('shuffle', false); } if (force || !settings.hasSync('scrollWithCurrentSong')) { diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 1c5956e..cd96eb0 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -17,8 +17,8 @@ settingsPath = fs.existsSync(settingsPath) export const getSettings = () => { const parsedSettings = JSON.parse(String(fs.readFileSync(settingsPath))); return { - repeat: parsedSettings.defaultRepeat, - shuffle: parsedSettings.defaultShuffle, + repeat: parsedSettings.repeat, + shuffle: parsedSettings.shuffle, volume: parsedSettings.volume, }; };