Show Playlist tracks

This commit is contained in:
Deluan
2020-05-15 13:48:33 -04:00
committed by Deluan Quintão
parent 8a709c489a
commit 0ca79eead4
11 changed files with 313 additions and 46 deletions
+42
View File
@@ -0,0 +1,42 @@
import React from 'react'
import { DatagridRow, useTranslate } from 'react-admin'
import { TableRow, TableCell, Typography } from '@material-ui/core'
import PropTypes from 'prop-types'
import RangeField from './RangeField'
const SongDatagridRow = ({ record, children, multiDisc, ...rest }) => {
const translate = useTranslate()
return (
<>
{multiDisc && (
<TableRow>
{record.trackNumber === 1 && (
<TableCell colSpan={children.length + 1}>
<Typography variant="h6">
{record.discSubtitle
? translate('message.discSubtitle', {
subtitle: record.discSubtitle,
number: record.discNumber,
})
: translate('message.discWithoutSubtitle', {
number: record.discNumber,
})}
</Typography>
</TableCell>
)}
</TableRow>
)}
<DatagridRow record={record} {...rest}>
{children}
</DatagridRow>
</>
)
}
RangeField.propTypes = {
record: PropTypes.object,
children: PropTypes.node,
multiDisc: PropTypes.bool,
}
export default SongDatagridRow
+2
View File
@@ -10,6 +10,7 @@ import SongDetails from './SongDetails'
import SizeField from './SizeField'
import DocLink from './DocLink'
import List from './List'
import SongDatagridRow from './SongDatagridRow'
export {
Title,
@@ -22,6 +23,7 @@ export {
SimpleList,
RangeField,
SongDetails,
SongDatagridRow,
DocLink,
formatRange,
ArtistLinkField,