Add more options to Players list

This commit is contained in:
Deluan
2020-06-08 15:32:14 -04:00
committed by Deluan Quintão
parent 84ed3eb427
commit c9bcb333ae
3 changed files with 23 additions and 2 deletions
+16 -2
View File
@@ -5,14 +5,27 @@ import {
DateField,
FunctionField,
ReferenceField,
Filter,
SearchInput,
} from 'react-admin'
import { useMediaQuery } from '@material-ui/core'
import { SimpleList, List } from '../common'
const PlayerList = (props) => {
const PlayerFilter = (props) => (
<Filter {...props}>
<SearchInput source="name" alwaysOn />
</Filter>
)
const PlayerList = ({ permissions, ...props }) => {
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
return (
<List exporter={false} {...props}>
<List
{...props}
sort={{ field: 'lastSeen', order: 'DESC' }}
exporter={false}
filters={<PlayerFilter />}
>
{isXsmall ? (
<SimpleList
primaryText={(r) => r.client}
@@ -22,6 +35,7 @@ const PlayerList = (props) => {
) : (
<Datagrid rowClick="edit">
<TextField source="name" />
{permissions === 'admin' && <TextField source="userName" />}
<ReferenceField source="transcodingId" reference="transcoding">
<TextField source="name" />
</ReferenceField>