mirror of
https://github.com/navidrome/navidrome.git
synced 2025-05-15 09:36:38 +03:00
26 lines
744 B
JavaScript
26 lines
744 B
JavaScript
import { SelectInput, useTranslate } from 'react-admin'
|
|
import albumLists, { defaultAlbumList } from '../album/albumLists'
|
|
|
|
export const SelectDefaultView = (props) => {
|
|
const translate = useTranslate()
|
|
const current = localStorage.getItem('defaultView') || defaultAlbumList
|
|
const choices = Object.keys(albumLists).map((type) => ({
|
|
id: type,
|
|
name: translate(`resources.album.lists.${type}`),
|
|
}))
|
|
|
|
return (
|
|
<SelectInput
|
|
{...props}
|
|
source="defaultView"
|
|
label={translate('menu.personal.options.defaultView')}
|
|
defaultValue={current}
|
|
choices={choices}
|
|
translateChoice={false}
|
|
onChange={(event) => {
|
|
localStorage.setItem('defaultView', event.target.value)
|
|
}}
|
|
/>
|
|
)
|
|
}
|