2020-01-22 09:02:19 -09:00
|
|
|
import React from 'react'
|
|
|
|
|
import {
|
|
|
|
|
Datagrid,
|
|
|
|
|
Filter,
|
|
|
|
|
NumberField,
|
|
|
|
|
SearchInput,
|
|
|
|
|
TextField,
|
|
|
|
|
} from 'react-admin'
|
2020-06-09 16:29:12 -08:00
|
|
|
import { List, useGetHandleArtistClick } from '../common'
|
|
|
|
|
import { withWidth } from '@material-ui/core'
|
2020-01-22 09:02:19 -09:00
|
|
|
|
|
|
|
|
const ArtistFilter = (props) => (
|
|
|
|
|
<Filter {...props}>
|
|
|
|
|
<SearchInput source="name" alwaysOn />
|
|
|
|
|
</Filter>
|
|
|
|
|
)
|
|
|
|
|
|
2020-06-09 16:29:12 -08:00
|
|
|
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>
|
|
|
|
|
)
|
|
|
|
|
}
|
2020-01-22 09:02:19 -09:00
|
|
|
|
2020-06-09 16:29:12 -08:00
|
|
|
export default withWidth()(ArtistList)
|