mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-19 08:38:50 +01:00
* feat: create vite project * feat: it's alive! * feat: `make dev` working! * feat: replace custom serviceWorker with vite plugin * test: replace Jest with Vitest * fix: run prettier * fix: skip eslint for now. * chore: remove ui.old folder * refactor: replace lodash.pick with simple destructuring * fix: eslint errors (wip) * fix: eslint errors (wip) * fix: display-name eslint errors (wip) * fix: no-console eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: build * fix: pwa manifest * refactor: pwa manifest * refactor: simplify PORT configuration * refactor: rename simple JS files * test: cover playlistUtils * fix: react-image-lightbox * feat(ui): add sourcemaps to help debug issues
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
import React from 'react'
|
|
import {
|
|
Datagrid,
|
|
TextField,
|
|
DateField,
|
|
FunctionField,
|
|
ReferenceField,
|
|
Filter,
|
|
SearchInput,
|
|
} from 'react-admin'
|
|
import { useMediaQuery } from '@material-ui/core'
|
|
import { SimpleList, List } from '../common'
|
|
|
|
const PlayerFilter = (props) => (
|
|
<Filter {...props} variant={'outlined'}>
|
|
<SearchInput id="search" source="name" alwaysOn />
|
|
</Filter>
|
|
)
|
|
|
|
const PlayerList = ({ permissions, ...props }) => {
|
|
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
|
return (
|
|
<List
|
|
{...props}
|
|
sort={{ field: 'lastSeen', order: 'DESC' }}
|
|
exporter={false}
|
|
filters={<PlayerFilter />}
|
|
>
|
|
{isXsmall ? (
|
|
<SimpleList
|
|
primaryText={(r) => r.name}
|
|
secondaryText={(r) => r.userName}
|
|
tertiaryText={(r) => (r.maxBitRate ? r.maxBitRate : '-')}
|
|
/>
|
|
) : (
|
|
<Datagrid rowClick="edit">
|
|
<TextField source="name" />
|
|
{permissions === 'admin' && <TextField source="userName" />}
|
|
<ReferenceField source="transcodingId" reference="transcoding">
|
|
<TextField source="name" />
|
|
</ReferenceField>
|
|
<FunctionField
|
|
source="maxBitRate"
|
|
render={(r) => (r.maxBitRate ? r.maxBitRate : '-')}
|
|
/>
|
|
<DateField source="lastSeen" showTime sortByOrder={'DESC'} />
|
|
</Datagrid>
|
|
)}
|
|
</List>
|
|
)
|
|
}
|
|
|
|
export default PlayerList
|