Add Song Details to Album view
This commit is contained in:
@@ -14,6 +14,7 @@ import { Card, useMediaQuery } from '@material-ui/core'
|
|||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import { setTrack } from '../audioplayer'
|
import { setTrack } from '../audioplayer'
|
||||||
import { DurationField } from '../common'
|
import { DurationField } from '../common'
|
||||||
|
import { SongDetails } from '../common'
|
||||||
|
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
(theme) => ({
|
(theme) => ({
|
||||||
@@ -64,6 +65,7 @@ const AlbumSongs = (props) => {
|
|||||||
const classes = useStyles(props)
|
const classes = useStyles(props)
|
||||||
const classesToolbar = useStylesListToolbar(props)
|
const classesToolbar = useStylesListToolbar(props)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
||||||
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
|
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
|
||||||
const controllerProps = useListController(props)
|
const controllerProps = useListController(props)
|
||||||
const { bulkActionButtons, albumId, expand, className } = props
|
const { bulkActionButtons, albumId, expand, className } = props
|
||||||
@@ -106,6 +108,7 @@ const AlbumSongs = (props) => {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Datagrid
|
<Datagrid
|
||||||
|
expand={!isXsmall && <SongDetails />}
|
||||||
rowClick={(id, basePath, record) => dispatch(setTrack(record))}
|
rowClick={(id, basePath, record) => dispatch(setTrack(record))}
|
||||||
{...controllerProps}
|
{...controllerProps}
|
||||||
hasBulkActions={hasBulkActions}
|
hasBulkActions={hasBulkActions}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import {
|
||||||
|
Show,
|
||||||
|
SimpleShowLayout,
|
||||||
|
BooleanField,
|
||||||
|
DateField,
|
||||||
|
TextField
|
||||||
|
} from 'react-admin'
|
||||||
|
import { BitrateField } from './index'
|
||||||
|
|
||||||
|
const SongDetails = (props) => {
|
||||||
|
return (
|
||||||
|
<Show {...props} title=" ">
|
||||||
|
<SimpleShowLayout>
|
||||||
|
<TextField source="path" />
|
||||||
|
<TextField source="albumArtist" />
|
||||||
|
<TextField source="genre" />
|
||||||
|
<BooleanField source="compilation" />
|
||||||
|
<BitrateField source="bitRate" />
|
||||||
|
<DateField source="updatedAt" showTime />
|
||||||
|
</SimpleShowLayout>
|
||||||
|
</Show>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SongDetails
|
||||||
@@ -5,6 +5,7 @@ import Pagination from './Pagination'
|
|||||||
import PlayButton from './PlayButton'
|
import PlayButton from './PlayButton'
|
||||||
import SimpleList from './SimpleList'
|
import SimpleList from './SimpleList'
|
||||||
import RangeField, { formatRange } from './RangeField'
|
import RangeField, { formatRange } from './RangeField'
|
||||||
|
import SongDetails from './SongDetails'
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Title,
|
Title,
|
||||||
@@ -14,5 +15,6 @@ export {
|
|||||||
PlayButton,
|
PlayButton,
|
||||||
SimpleList,
|
SimpleList,
|
||||||
RangeField,
|
RangeField,
|
||||||
|
SongDetails,
|
||||||
formatRange
|
formatRange
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-20
@@ -1,20 +1,15 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {
|
import {
|
||||||
BooleanField,
|
|
||||||
Datagrid,
|
Datagrid,
|
||||||
DateField,
|
|
||||||
Filter,
|
Filter,
|
||||||
FunctionField,
|
FunctionField,
|
||||||
List,
|
List,
|
||||||
NumberField,
|
NumberField,
|
||||||
SearchInput,
|
SearchInput,
|
||||||
Show,
|
|
||||||
SimpleShowLayout,
|
|
||||||
TextField
|
TextField
|
||||||
} from 'react-admin'
|
} from 'react-admin'
|
||||||
import { useMediaQuery } from '@material-ui/core'
|
import { useMediaQuery } from '@material-ui/core'
|
||||||
import {
|
import {
|
||||||
BitrateField,
|
|
||||||
DurationField,
|
DurationField,
|
||||||
Pagination,
|
Pagination,
|
||||||
PlayButton,
|
PlayButton,
|
||||||
@@ -26,6 +21,7 @@ import { addTrack, setTrack } from '../audioplayer'
|
|||||||
import AddIcon from '@material-ui/icons/Add'
|
import AddIcon from '@material-ui/icons/Add'
|
||||||
import { SongBulkActions } from './SongBulkActions'
|
import { SongBulkActions } from './SongBulkActions'
|
||||||
import { AlbumLinkField } from './AlbumLinkField'
|
import { AlbumLinkField } from './AlbumLinkField'
|
||||||
|
import { SongDetails } from '../common'
|
||||||
|
|
||||||
const SongFilter = (props) => (
|
const SongFilter = (props) => (
|
||||||
<Filter {...props}>
|
<Filter {...props}>
|
||||||
@@ -33,21 +29,6 @@ const SongFilter = (props) => (
|
|||||||
</Filter>
|
</Filter>
|
||||||
)
|
)
|
||||||
|
|
||||||
const SongDetails = (props) => {
|
|
||||||
return (
|
|
||||||
<Show {...props} title=" ">
|
|
||||||
<SimpleShowLayout>
|
|
||||||
<TextField source="path" />
|
|
||||||
<TextField source="albumArtist" />
|
|
||||||
<TextField source="genre" />
|
|
||||||
<BooleanField source="compilation" />
|
|
||||||
<BitrateField source="bitRate" />
|
|
||||||
<DateField source="updatedAt" showTime />
|
|
||||||
</SimpleShowLayout>
|
|
||||||
</Show>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const SongList = (props) => {
|
const SongList = (props) => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
|
||||||
|
|||||||
Reference in New Issue
Block a user