Browse Source

Add legacy artist view toggle (#199)

master
jeffvli 3 years ago
parent
commit
b51c5afec9
  1. 6
      src/components/library/ArtistView.tsx
  2. 20
      src/components/settings/ConfigPanels/LookAndFeelConfig.tsx
  3. 4
      src/components/shared/setDefaultSettings.ts
  4. 1
      src/shared/mockSettings.ts

6
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) {

20
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) => {
}
/>
<Divider />
<ConfigOption
name={t('Start page')}
description={t('Page Sonixd will display on start.')}
@ -554,7 +556,7 @@ 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) => {
}
/>
)}
<ConfigOption
name={t('Default to Album List on Artist Page')}
description={t(
'Enabling this will open the Artist page to their list of albums instead of the main page.'
)}
option={
<StyledToggle
defaultChecked={Boolean(settings.getSync('artistPageLegacy'))}
onChange={(e: boolean) => {
settings.setSync('artistPageLegacy', e);
}}
/>
}
/>
</ConfigPanel>
);
};

4
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', '/');
}

1
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,

Loading…
Cancel
Save