quintodrome/ui/src/player/PlayerList.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-03-12 05:38:07 -08:00
import React from 'react'
import {
Datagrid,
TextField,
DateField,
FunctionField,
ReferenceField,
} from 'react-admin'
import { useMediaQuery } from '@material-ui/core'
2020-05-15 06:20:11 -08:00
import { SimpleList, List } from '../common'
2020-03-12 05:38:07 -08:00
const PlayerList = (props) => {
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
return (
2020-05-15 06:20:11 -08:00
<List exporter={false} {...props}>
{isXsmall ? (
<SimpleList
primaryText={(r) => r.client}
secondaryText={(r) => r.userName}
2020-05-04 16:27:09 -08:00
tertiaryText={(r) => (r.maxBitRate ? r.maxBitRate : '-')}
/>
) : (
<Datagrid rowClick="edit">
<TextField source="name" />
<ReferenceField source="transcodingId" reference="transcoding">
<TextField source="name" />
</ReferenceField>
<FunctionField
source="maxBitRate"
2020-05-04 16:27:09 -08:00
render={(r) => (r.maxBitRate ? r.maxBitRate : '-')}
/>
<DateField source="lastSeen" showTime sortByOrder={'DESC'} />
</Datagrid>
)}
</List>
)
}
2020-03-12 05:38:07 -08:00
export default PlayerList