2020-01-22 09:02:19 -09:00
|
|
|
import React from 'react'
|
|
|
|
|
import {
|
|
|
|
|
Datagrid,
|
|
|
|
|
Filter,
|
|
|
|
|
List,
|
|
|
|
|
NumberField,
|
|
|
|
|
SearchInput,
|
|
|
|
|
TextField,
|
|
|
|
|
} from 'react-admin'
|
2020-02-05 09:28:39 -09:00
|
|
|
import { Pagination, Title } from '../common'
|
2020-01-22 09:02:19 -09:00
|
|
|
|
|
|
|
|
const ArtistFilter = (props) => (
|
|
|
|
|
<Filter {...props}>
|
|
|
|
|
<SearchInput source="name" alwaysOn />
|
|
|
|
|
</Filter>
|
|
|
|
|
)
|
|
|
|
|
|
2020-01-22 10:18:55 -09:00
|
|
|
const artistRowClick = (id) => {
|
|
|
|
|
const filter = { artist_id: id }
|
2020-03-25 14:51:13 -08:00
|
|
|
return `/album?filter=${JSON.stringify(
|
|
|
|
|
filter
|
2020-03-27 16:01:08 -08:00
|
|
|
)}&order=ASC&sort=maxYear&displayedFilters={"compilation":true}`
|
2020-01-22 10:18:55 -09:00
|
|
|
}
|
2020-01-22 09:02:19 -09:00
|
|
|
|
|
|
|
|
const ArtistList = (props) => (
|
|
|
|
|
<List
|
|
|
|
|
{...props}
|
2020-04-27 19:22:17 -08:00
|
|
|
title={
|
|
|
|
|
<Title subTitle={'resources.artist.name'} args={{ smart_count: 2 }} />
|
|
|
|
|
}
|
2020-04-24 13:37:28 -08:00
|
|
|
sort={{ field: 'name', order: 'ASC' }}
|
2020-01-22 09:02:19 -09:00
|
|
|
exporter={false}
|
|
|
|
|
bulkActionButtons={false}
|
|
|
|
|
filters={<ArtistFilter />}
|
2020-02-05 09:28:39 -09:00
|
|
|
perPage={15}
|
|
|
|
|
pagination={<Pagination />}
|
2020-01-22 09:02:19 -09:00
|
|
|
>
|
|
|
|
|
<Datagrid rowClick={artistRowClick}>
|
2020-04-24 13:37:28 -08:00
|
|
|
<TextField source="name" />
|
2020-01-22 09:02:19 -09:00
|
|
|
<NumberField source="albumCount" />
|
|
|
|
|
</Datagrid>
|
|
|
|
|
</List>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
export default ArtistList
|