Change default sort for albums view to alphabetically (list) or most recent (grid)

This commit is contained in:
Deluan 2020-04-14 09:26:59 -04:00
parent 2b06f20f41
commit 3a54246b15
1 changed files with 7 additions and 1 deletions

View File

@ -53,7 +53,12 @@ const getPerPageOptions = (width) => {
const AlbumList = (props) => {
const { width } = props
const albumView = useSelector((state) => state.albumView)
let sort
if (albumView.mode === ALBUM_MODE_LIST) {
sort = { field: 'name', order: 'ASC' }
} else {
sort = { field: 'created_at', order: 'DESC' }
}
return (
<List
{...props}
@ -61,6 +66,7 @@ const AlbumList = (props) => {
exporter={false}
bulkActionButtons={false}
actions={<AlbumListActions />}
sort={sort}
filters={<AlbumFilter />}
perPage={getPerPage(width)}
pagination={<Pagination rowsPerPageOptions={getPerPageOptions(width)} />}