/
PlayerList.js
46 lines (44 loc) 路 1.17 KB
/
PlayerList.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react'
import {
Datagrid,
List,
TextField,
DateField,
FunctionField,
ReferenceField,
} from 'react-admin'
import { useMediaQuery } from '@material-ui/core'
import { SimpleList, Title } from '../common'
const PlayerList = (props) => {
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
return (
<List
title={
<Title subTitle={'resources.player.name'} args={{ smart_count: 2 }} />
}
exporter={false}
{...props}
>
{isXsmall ? (
<SimpleList
primaryText={(r) => r.client}
secondaryText={(r) => r.userName}
tertiaryText={(r) => (r.maxBitRate ? r.maxBitRate : '-')}
/>
) : (
<Datagrid rowClick="edit">
<TextField source="name" />
<ReferenceField source="transcodingId" reference="transcoding">
<TextField source="name" />
</ReferenceField>
<FunctionField
source="maxBitRate"
render={(r) => (r.maxBitRate ? r.maxBitRate : '-')}
/>
<DateField source="lastSeen" showTime />
</Datagrid>
)}
</List>
)
}
export default PlayerList