Change default sort for albums view to alphabetically (list) or most recent (grid)
This commit is contained in:
@@ -53,7 +53,12 @@ const getPerPageOptions = (width) => {
|
|||||||
const AlbumList = (props) => {
|
const AlbumList = (props) => {
|
||||||
const { width } = props
|
const { width } = props
|
||||||
const albumView = useSelector((state) => state.albumView)
|
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 (
|
return (
|
||||||
<List
|
<List
|
||||||
{...props}
|
{...props}
|
||||||
@@ -61,6 +66,7 @@ const AlbumList = (props) => {
|
|||||||
exporter={false}
|
exporter={false}
|
||||||
bulkActionButtons={false}
|
bulkActionButtons={false}
|
||||||
actions={<AlbumListActions />}
|
actions={<AlbumListActions />}
|
||||||
|
sort={sort}
|
||||||
filters={<AlbumFilter />}
|
filters={<AlbumFilter />}
|
||||||
perPage={getPerPage(width)}
|
perPage={getPerPage(width)}
|
||||||
pagination={<Pagination rowsPerPageOptions={getPerPageOptions(width)} />}
|
pagination={<Pagination rowsPerPageOptions={getPerPageOptions(width)} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user