Change default album view mode to Grid
This commit is contained in:
@@ -58,12 +58,6 @@ 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}
|
||||||
@@ -73,7 +67,7 @@ const AlbumList = (props) => {
|
|||||||
exporter={false}
|
exporter={false}
|
||||||
bulkActionButtons={false}
|
bulkActionButtons={false}
|
||||||
actions={<AlbumListActions />}
|
actions={<AlbumListActions />}
|
||||||
sort={sort}
|
sort={{ field: 'created_at', order: 'DESC' }}
|
||||||
filters={<AlbumFilter />}
|
filters={<AlbumFilter />}
|
||||||
perPage={getPerPage(width)}
|
perPage={getPerPage(width)}
|
||||||
pagination={<Pagination rowsPerPageOptions={getPerPageOptions(width)} />}
|
pagination={<Pagination rowsPerPageOptions={getPerPageOptions(width)} />}
|
||||||
|
|||||||
@@ -42,13 +42,6 @@ const AlbumListActions = ({
|
|||||||
color="primary"
|
color="primary"
|
||||||
aria-label="text primary button group"
|
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
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
color={albumView.mode === ALBUM_MODE_GRID ? 'primary' : 'secondary'}
|
color={albumView.mode === ALBUM_MODE_GRID ? 'primary' : 'secondary'}
|
||||||
@@ -56,6 +49,13 @@ const AlbumListActions = ({
|
|||||||
>
|
>
|
||||||
<ViewModuleIcon fontSize="inherit" />
|
<ViewModuleIcon fontSize="inherit" />
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
color={albumView.mode === ALBUM_MODE_LIST ? 'primary' : 'secondary'}
|
||||||
|
onClick={() => dispatch(selectViewMode(ALBUM_MODE_LIST))}
|
||||||
|
>
|
||||||
|
<ViewHeadlineIcon fontSize="inherit" />
|
||||||
|
</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</TopToolbar>
|
</TopToolbar>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const selectAlbumList = (mode) => ({ type: mode })
|
|||||||
|
|
||||||
const albumViewReducer = (
|
const albumViewReducer = (
|
||||||
previousState = {
|
previousState = {
|
||||||
mode: ALBUM_MODE_LIST,
|
mode: ALBUM_MODE_GRID,
|
||||||
list: ALBUM_LIST_ALL,
|
list: ALBUM_LIST_ALL,
|
||||||
params: { sort: {}, filter: {} },
|
params: { sort: {}, filter: {} },
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user