2020-02-07 12:38:01 -09:00
|
|
|
import React from 'react'
|
2020-02-07 08:36:26 -09:00
|
|
|
import { Card, CardContent, CardMedia, Typography } from '@material-ui/core'
|
|
|
|
|
import { subsonicUrl } from '../subsonic'
|
|
|
|
|
|
2020-02-12 16:35:35 -09:00
|
|
|
const AlbumDetails = ({ classes, record }) => {
|
|
|
|
|
const genreYear = (record) => {
|
2020-02-07 08:36:26 -09:00
|
|
|
let genreDateLine = []
|
2020-02-12 16:35:35 -09:00
|
|
|
if (record.genre) {
|
|
|
|
|
genreDateLine.push(record.genre)
|
2020-02-07 08:36:26 -09:00
|
|
|
}
|
2020-02-12 16:35:35 -09:00
|
|
|
if (record.year) {
|
|
|
|
|
genreDateLine.push(record.year)
|
2020-02-07 08:36:26 -09:00
|
|
|
}
|
|
|
|
|
return genreDateLine.join(' - ')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Card className={classes.container}>
|
|
|
|
|
<CardMedia
|
2020-02-07 12:51:14 -09:00
|
|
|
image={subsonicUrl(
|
|
|
|
|
'getCoverArt',
|
2020-02-12 16:35:35 -09:00
|
|
|
record.coverArtId || 'not_found',
|
2020-02-07 12:51:14 -09:00
|
|
|
'size=500'
|
|
|
|
|
)}
|
2020-02-07 08:36:26 -09:00
|
|
|
className={classes.albumCover}
|
|
|
|
|
/>
|
|
|
|
|
<CardContent className={classes.albumDetails}>
|
|
|
|
|
<Typography variant="h5" className={classes.albumTitle}>
|
2020-02-12 16:35:35 -09:00
|
|
|
{record.name}
|
2020-02-07 08:36:26 -09:00
|
|
|
</Typography>
|
|
|
|
|
<Typography component="h6">
|
2020-02-12 16:35:35 -09:00
|
|
|
{record.albumArtist || record.artist}
|
2020-02-07 08:36:26 -09:00
|
|
|
</Typography>
|
2020-02-12 16:35:35 -09:00
|
|
|
<Typography component="p">{genreYear(record)}</Typography>
|
2020-02-07 08:36:26 -09:00
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
)
|
|
|
|
|
}
|
2020-02-07 11:04:45 -09:00
|
|
|
|
|
|
|
|
export default AlbumDetails
|