feat: add song count and duration to AlbumDetails
This commit is contained in:
@@ -19,7 +19,7 @@ export const AlbumActions = ({
|
|||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const translation = useTranslate()
|
const translate = useTranslate()
|
||||||
|
|
||||||
const shuffle = (data) => {
|
const shuffle = (data) => {
|
||||||
const ids = Object.keys(data)
|
const ids = Object.keys(data)
|
||||||
@@ -39,7 +39,7 @@ export const AlbumActions = ({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
dispatch(playAlbum(ids[0], data))
|
dispatch(playAlbum(ids[0], data))
|
||||||
}}
|
}}
|
||||||
label={translation('resources.album.actions.playAll')}
|
label={translate('resources.album.actions.playAll')}
|
||||||
>
|
>
|
||||||
<PlayArrowIcon />
|
<PlayArrowIcon />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -50,7 +50,7 @@ export const AlbumActions = ({
|
|||||||
const firstId = Object.keys(shuffled)[0]
|
const firstId = Object.keys(shuffled)[0]
|
||||||
dispatch(playAlbum(firstId, shuffled))
|
dispatch(playAlbum(firstId, shuffled))
|
||||||
}}
|
}}
|
||||||
label={translation('resources.album.actions.shuffle')}
|
label={translate('resources.album.actions.shuffle')}
|
||||||
>
|
>
|
||||||
<ShuffleIcon />
|
<ShuffleIcon />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Card, CardContent, CardMedia, Typography } from '@material-ui/core'
|
import { Card, CardContent, CardMedia, Typography } from '@material-ui/core'
|
||||||
|
import { useTranslate } from 'react-admin'
|
||||||
import { subsonicUrl } from '../subsonic'
|
import { subsonicUrl } from '../subsonic'
|
||||||
|
import { DurationField } from '../common'
|
||||||
|
|
||||||
const AlbumDetails = ({ classes, record }) => {
|
const AlbumDetails = ({ classes, record }) => {
|
||||||
|
const translate = useTranslate()
|
||||||
const genreYear = (record) => {
|
const genreYear = (record) => {
|
||||||
let genreDateLine = []
|
let genreDateLine = []
|
||||||
if (record.genre) {
|
if (record.genre) {
|
||||||
@@ -11,7 +14,7 @@ const AlbumDetails = ({ classes, record }) => {
|
|||||||
if (record.year) {
|
if (record.year) {
|
||||||
genreDateLine.push(record.year)
|
genreDateLine.push(record.year)
|
||||||
}
|
}
|
||||||
return genreDateLine.join(' - ')
|
return genreDateLine.join(' · ')
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -32,6 +35,11 @@ const AlbumDetails = ({ classes, record }) => {
|
|||||||
{record.albumArtist || record.artist}
|
{record.albumArtist || record.artist}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography component="p">{genreYear(record)}</Typography>
|
<Typography component="p">{genreYear(record)}</Typography>
|
||||||
|
<Typography component="p">
|
||||||
|
{record.songCount}{' '}
|
||||||
|
{translate('resources.song.name', { smart_count: record.songCount })}{' '}
|
||||||
|
· <DurationField record={record} source={'duration'} />
|
||||||
|
</Typography>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import englishMessages from 'ra-language-english'
|
|||||||
export default deepmerge(englishMessages, {
|
export default deepmerge(englishMessages, {
|
||||||
resources: {
|
resources: {
|
||||||
song: {
|
song: {
|
||||||
|
name: 'Song |||| Songs',
|
||||||
fields: {
|
fields: {
|
||||||
albumArtist: 'Album Artist',
|
albumArtist: 'Album Artist',
|
||||||
duration: 'Time',
|
duration: 'Time',
|
||||||
|
|||||||
Reference in New Issue
Block a user