Skip to content

Commit

Permalink
Change default sort for albums view to alphabetically (list) or most …
Browse files Browse the repository at this point in the history
…recent (grid)
  • Loading branch information
deluan committed Apr 14, 2020
1 parent 2b06f20 commit 3a54246
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ui/src/album/AlbumList.js
Expand Up @@ -53,14 +53,20 @@ 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}
title={<Title subTitle={'Albums'} />}
exporter={false}
bulkActionButtons={false}
actions={<AlbumListActions />}
sort={sort}
filters={<AlbumFilter />}
perPage={getPerPage(width)}
pagination={<Pagination rowsPerPageOptions={getPerPageOptions(width)} />}
Expand Down

0 comments on commit 3a54246

Please sign in to comment.