From b51c5afec932bdffc3bb4841db4c489f602eb8ad Mon Sep 17 00:00:00 2001 From: jeffvli Date: Thu, 27 Jan 2022 19:17:25 -0800 Subject: [PATCH] Add legacy artist view toggle (#199) --- src/components/library/ArtistView.tsx | 6 ++++++ .../ConfigPanels/LookAndFeelConfig.tsx | 20 +++++++++++++++++-- src/components/shared/setDefaultSettings.ts | 4 ++++ src/shared/mockSettings.ts | 1 + 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/components/library/ArtistView.tsx b/src/components/library/ArtistView.tsx index 2e96dbe..925eaf6 100644 --- a/src/components/library/ArtistView.tsx +++ b/src/components/library/ArtistView.tsx @@ -145,6 +145,12 @@ const ArtistView = ({ ...rest }: any) => { 'year', ]); + useEffect(() => { + if (settings.getSync('artistPageLegacy')) { + history.push(`/library/artist/${artistId}/albums`); + } + }, [artistId, history]); + let timeout: any = null; const handleRowClick = (e: any, rowData: any, tableData: any) => { if (timeout === null) { diff --git a/src/components/settings/ConfigPanels/LookAndFeelConfig.tsx b/src/components/settings/ConfigPanels/LookAndFeelConfig.tsx index 54fb24e..0ecbb93 100644 --- a/src/components/settings/ConfigPanels/LookAndFeelConfig.tsx +++ b/src/components/settings/ConfigPanels/LookAndFeelConfig.tsx @@ -2,7 +2,7 @@ import React, { useRef, useState } from 'react'; import _ from 'lodash'; import { ipcRenderer, shell } from 'electron'; import settings from 'electron-settings'; -import { Nav, Icon, RadioGroup, Whisper } from 'rsuite'; +import { Nav, Icon, RadioGroup, Whisper, Divider } from 'rsuite'; import { WhisperInstance } from 'rsuite/lib/Whisper'; import { Trans, useTranslation } from 'react-i18next'; import { ConfigOptionDescription, ConfigPanel } from '../styled'; @@ -474,6 +474,8 @@ export const ThemeConfigPanel = ({ bordered }: any) => { } /> + + { container={() => musicSortDefaultPickerContainerRef.current} data={MUSIC_SORT_TYPES} cleanable={false} - defaultValue={String(settings.getSync('musicSortDefault'))} + defaultValue={String(settings.getSync(''))} width={200} onChange={(e: string) => { settings.setSync('musicSortDefault', e); @@ -564,6 +566,20 @@ export const ThemeConfigPanel = ({ bordered }: any) => { } /> )} + { + settings.setSync('artistPageLegacy', e); + }} + /> + } + /> ); }; diff --git a/src/components/shared/setDefaultSettings.ts b/src/components/shared/setDefaultSettings.ts index bd0d068..17c6427 100644 --- a/src/components/shared/setDefaultSettings.ts +++ b/src/components/shared/setDefaultSettings.ts @@ -95,6 +95,10 @@ const setDefaultSettings = (force: boolean) => { settings.setSync('titleBarStyle', 'windows'); } + if (force || !settings.hasSync('artistPageLegacy')) { + settings.setSync('artistPageLegacy', false); + } + if (force || !settings.hasSync('startPage')) { settings.setSync('startPage', '/'); } diff --git a/src/shared/mockSettings.ts b/src/shared/mockSettings.ts index 3f0b332..f91e3dc 100644 --- a/src/shared/mockSettings.ts +++ b/src/shared/mockSettings.ts @@ -10,6 +10,7 @@ export const mockSettings = { systemMediaTransportControls: false, cachePath: 'C:\\Users\\jli\\AppData\\Roaming\\Electron', legacyAuth: false, + artistPageLegacy: false, volume: 0.93, audioDeviceId: null, seekForwardInterval: 5,