Fix navigation issues caused by the use of useListParams

This commit is contained in:
Deluan
2020-06-09 20:29:12 -04:00
parent 7148741a4f
commit a64b15c174
8 changed files with 91 additions and 58 deletions
+21 -17
View File
@@ -6,7 +6,8 @@ import {
SearchInput,
TextField,
} from 'react-admin'
import { artistLink, List } from '../common'
import { List, useGetHandleArtistClick } from '../common'
import { withWidth } from '@material-ui/core'
const ArtistFilter = (props) => (
<Filter {...props}>
@@ -14,20 +15,23 @@ const ArtistFilter = (props) => (
</Filter>
)
const ArtistList = (props) => (
<List
{...props}
sort={{ field: 'name', order: 'ASC' }}
exporter={false}
bulkActionButtons={false}
filters={<ArtistFilter />}
>
<Datagrid rowClick={artistLink}>
<TextField source="name" />
<NumberField source="albumCount" sortByOrder={'DESC'} />
<NumberField source="songCount" sortByOrder={'DESC'} />
</Datagrid>
</List>
)
const ArtistList = ({ width, ...props }) => {
const handleArtistLink = useGetHandleArtistClick(width)
return (
<List
{...props}
sort={{ field: 'name', order: 'ASC' }}
exporter={false}
bulkActionButtons={false}
filters={<ArtistFilter />}
>
<Datagrid rowClick={handleArtistLink}>
<TextField source="name" />
<NumberField source="albumCount" sortByOrder={'DESC'} />
<NumberField source="songCount" sortByOrder={'DESC'} />
</Datagrid>
</List>
)
}
export default ArtistList
export default withWidth()(ArtistList)