Add songs option for default view selector in personal settings #2

Open
arian wants to merge 1 commits from feat/songs-default-view into master
2 changed files with 12 additions and 1 deletions
+3
View File
@@ -225,6 +225,9 @@ const AlbumList = (props) => {
const type = const type =
albumListType || localStorage.getItem('defaultView') || defaultAlbumList albumListType || localStorage.getItem('defaultView') || defaultAlbumList
const listParams = albumLists[type] const listParams = albumLists[type]
if (type === 'songs') {
return <Redirect to="/song" />
}
if (type === 'random') { if (type === 'random') {
refresh() refresh()
} }
+9 -1
View File
@@ -4,11 +4,19 @@ import albumLists, { defaultAlbumList } from '../album/albumLists'
export const SelectDefaultView = (props) => { export const SelectDefaultView = (props) => {
const translate = useTranslate() const translate = useTranslate()
const current = localStorage.getItem('defaultView') || defaultAlbumList const current = localStorage.getItem('defaultView') || defaultAlbumList
const choices = Object.keys(albumLists).map((type) => ({
const albumChoices = Object.keys(albumLists).map((type) => ({
id: type, id: type,
name: translate(`resources.album.lists.${type}`), name: translate(`resources.album.lists.${type}`),
})) }))
const songChoice = {
id: 'songs',
name: translate('resources.song.name', { smart_count: 2 }),
}
const choices = [...albumChoices, songChoice]
return ( return (
<SelectInput <SelectInput
{...props} {...props}