Change default album view mode to Grid

This commit is contained in:
Deluan 2020-05-05 15:34:31 -04:00
parent a8d3466b0e
commit 8880294ee7
3 changed files with 9 additions and 15 deletions

View File

@ -58,12 +58,6 @@ 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}
@ -73,7 +67,7 @@ const AlbumList = (props) => {
exporter={false}
bulkActionButtons={false}
actions={<AlbumListActions />}
sort={sort}
sort={{ field: 'created_at', order: 'DESC' }}
filters={<AlbumFilter />}
perPage={getPerPage(width)}
pagination={<Pagination rowsPerPageOptions={getPerPageOptions(width)} />}

View File

@ -42,13 +42,6 @@ const AlbumListActions = ({
color="primary"
aria-label="text primary button group"
>
<Button
size="small"
color={albumView.mode === ALBUM_MODE_LIST ? 'primary' : 'secondary'}
onClick={() => dispatch(selectViewMode(ALBUM_MODE_LIST))}
>
<ViewHeadlineIcon fontSize="inherit" />
</Button>
<Button
size="small"
color={albumView.mode === ALBUM_MODE_GRID ? 'primary' : 'secondary'}
@ -56,6 +49,13 @@ const AlbumListActions = ({
>
<ViewModuleIcon fontSize="inherit" />
</Button>
<Button
size="small"
color={albumView.mode === ALBUM_MODE_LIST ? 'primary' : 'secondary'}
onClick={() => dispatch(selectViewMode(ALBUM_MODE_LIST))}
>
<ViewHeadlineIcon fontSize="inherit" />
</Button>
</ButtonGroup>
</TopToolbar>
)

View File

@ -22,7 +22,7 @@ const selectAlbumList = (mode) => ({ type: mode })
const albumViewReducer = (
previousState = {
mode: ALBUM_MODE_LIST,
mode: ALBUM_MODE_GRID,
list: ALBUM_LIST_ALL,
params: { sort: {}, filter: {} },
},