Utils y mejoras en release
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import React, {Fragment, useEffect, useState} from 'react';
|
||||
import {Link} from "react-router-dom";
|
||||
|
||||
import {capitalize, toDuration} from "../services/utils";
|
||||
import {getRelease, getReleaseSongs} from "../services/entity_service";
|
||||
|
||||
import {CoverArt} from "../components/CoverArt";
|
||||
import {Entity} from "../components/Entity";
|
||||
import {EntityList} from "../components/EntityList";
|
||||
|
||||
const capitalize = (string) => {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
const Recordings = (props) => {
|
||||
const recordings = props.recordings ? props.recordings : null;
|
||||
@@ -20,8 +19,8 @@ const Recordings = (props) => {
|
||||
'link': props.makeLink(recording.id),
|
||||
'title': recording.title,
|
||||
'subtitle': (<Fragment>
|
||||
<div>{recording.length}</div>
|
||||
<div>{capitalize(recording.disambiguation)}</div>
|
||||
{recording.length && <div>[{toDuration(recording.length)}]</div>}
|
||||
{recording.disambiguation && <div>{capitalize(recording.disambiguation)}</div>}
|
||||
</Fragment>),
|
||||
'selected': props.selected === recording.id
|
||||
|
||||
@@ -40,8 +39,13 @@ const Recordings = (props) => {
|
||||
const Release = (props) => {
|
||||
const release = props.release;
|
||||
if (release){
|
||||
const subtitle = (
|
||||
<Link to={`/artist/${release.artist.id}`}>
|
||||
{`${release.artist.name} (${release.date})`}
|
||||
</Link>
|
||||
)
|
||||
return <Entity title={release.title}
|
||||
subtitle={`${release.artist.name} - [${release.date}]`}
|
||||
subtitle={subtitle}
|
||||
buttonText='Agregar a mi lista'
|
||||
cover={<CoverArt release={release}/>}/>
|
||||
}else {
|
||||
|
||||
Reference in New Issue
Block a user