quintodrome/ui/src/player/PlayerList.js

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

47 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-03-12 05:38:07 -08:00
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'
2020-03-12 05:38:07 -08:00
const PlayerList = (props) => {
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
return (
2020-04-27 19:22:17 -08:00
<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 : 'Unlimited')}
/>
) : (
<Datagrid rowClick="edit">
<TextField source="name" />
<ReferenceField source="transcodingId" reference="transcoding">
<TextField source="name" />
</ReferenceField>
<FunctionField
source="maxBitRate"
render={(r) => (r.maxBitRate ? r.maxBitRate : 'Unlimited')}
/>
<DateField source="lastSeen" showTime />
</Datagrid>
)}
</List>
)
}
2020-03-12 05:38:07 -08:00
export default PlayerList