Fix link to Artist's albums in mobile view

This commit is contained in:
Deluan
2020-09-25 16:48:31 -04:00
parent e6d1e67297
commit ab0e091736
+22 -17
View File
@@ -1,4 +1,5 @@
import React, { cloneElement, isValidElement, useState } from 'react' import React, { cloneElement, isValidElement, useState } from 'react'
import { useHistory } from 'react-router-dom'
import { import {
Datagrid, Datagrid,
DatagridBody, DatagridBody,
@@ -71,23 +72,17 @@ const ArtistDatagrid = (props) => (
<Datagrid {...props} body={<ArtistDatagridBody />} /> <Datagrid {...props} body={<ArtistDatagridBody />} />
) )
const ArtistList = ({ width, ...rest }) => { const ArtistListView = ({ hasShow, hasEdit, hasList, width, ...rest }) => {
const classes = useStyles() const classes = useStyles()
const handleArtistLink = useGetHandleArtistClick(width) const handleArtistLink = useGetHandleArtistClick(width)
const history = useHistory()
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs')) const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
return ( return isXsmall ? (
<>
<List
{...rest}
sort={{ field: 'name', order: 'ASC' }}
exporter={false}
bulkActionButtons={false}
filters={<ArtistFilter />}
>
{isXsmall ? (
<SimpleList <SimpleList
primaryText={(r) => r.name} primaryText={(r) => r.name}
linkType={'show'} linkType={(id) => {
history.push(handleArtistLink(id))
}}
rightIcon={(r) => <ArtistContextMenu record={r} />} rightIcon={(r) => <ArtistContextMenu record={r} />}
{...rest} {...rest}
/> />
@@ -102,14 +97,24 @@ const ArtistList = ({ width, ...rest }) => {
sortBy={'starred ASC, starredAt ASC'} sortBy={'starred ASC, starredAt ASC'}
sortByOrder={'DESC'} sortByOrder={'DESC'}
label={ label={
<StarBorderIcon <StarBorderIcon fontSize={'small'} className={classes.columnIcon} />
fontSize={'small'}
className={classes.columnIcon}
/>
} }
/> />
</ArtistDatagrid> </ArtistDatagrid>
)} )
}
const ArtistList = (props) => {
return (
<>
<List
{...props}
sort={{ field: 'name', order: 'ASC' }}
exporter={false}
bulkActionButtons={false}
filters={<ArtistFilter />}
>
<ArtistListView {...props} />
</List> </List>
<AddToPlaylistDialog /> <AddToPlaylistDialog />
</> </>