feat: initial integration of react-jinke-music-player

This commit is contained in:
Deluan
2020-02-04 09:26:54 -05:00
parent 220ffd5324
commit 4a82a6cb02
13 changed files with 417 additions and 44 deletions
+34 -24
View File
@@ -1,4 +1,4 @@
import React from 'react'
import React, { Fragment } from 'react'
import {
BooleanField,
Datagrid,
@@ -7,12 +7,14 @@ import {
List,
NumberField,
SearchInput,
TextInput,
Show,
SimpleShowLayout,
TextField
TextField,
TextInput
} from 'react-admin'
import { BitrateField, DurationField, Title } from '../common'
import AddToQueueButton from './AddToQueueButton'
import PlayButton from './PlayButton'
const SongFilter = (props) => (
<Filter {...props}>
@@ -22,6 +24,12 @@ const SongFilter = (props) => (
</Filter>
)
const SongBulkActionButtons = (props) => (
<Fragment>
<AddToQueueButton {...props} />
</Fragment>
)
const SongDetails = (props) => {
return (
<Show {...props} title=" ">
@@ -37,26 +45,28 @@ const SongDetails = (props) => {
)
}
const SongList = (props) => (
<List
{...props}
title={<Title subTitle={'Songs'} />}
sort={{ field: 'title', order: 'ASC' }}
exporter={false}
bulkActionButtons={false}
filters={<SongFilter />}
perPage={15}
>
<Datagrid expand={<SongDetails />}>
<TextField source="title" />
<TextField source="album" />
<TextField source="artist" />
<NumberField label="Track #" source="trackNumber" />
<NumberField label="Disc #" source="discNumber" />
<TextField source="year" />
<DurationField label="Time" source="duration" />
</Datagrid>
</List>
)
const SongList = (props) => {
return (
<List
{...props}
title={<Title subTitle={'Songs'} />}
sort={{ field: 'title', order: 'ASC' }}
exporter={false}
bulkActionButtons={<SongBulkActionButtons />}
filters={<SongFilter />}
>
<Datagrid expand={<SongDetails />}>
<PlayButton {...props} />
<TextField source="title" />
<TextField source="album" />
<TextField source="artist" />
<NumberField label="Track #" source="trackNumber" />
<NumberField label="Disc #" source="discNumber" />
<TextField source="year" />
<DurationField label="Time" source="duration" />
</Datagrid>
</List>
)
}
export default SongList