import React, {Fragment, useEffect, useState} from 'react';
import {capitalize, toDuration} from "../services/utils";
import {getSong} from "../services/entity_service";
import {Entity} from "../components/Entity";
import {Comments} from "../components/Comments";
const Song = (props) => {
const song = props.song;
if(!song) {
return
}
let subtitle = ''
if(song.disambiguation && song.length) {
subtitle = {capitalize(song.disambiguation)} - [{toDuration(song.length)}]
}else if (song.disambiguation) {
subtitle = {capitalize(song.disambiguation)}
}else if (song.length) {
subtitle = [{toDuration(song.length)}]
}
return
}
export const SongView = (props) => {
const mbid = props.match.params.mbid;
const [song, setSong] = useState(null);
useEffect(() => {
if (mbid) {
getSong(mbid).then((result) => setSong(result));
}
}, [mbid]);
return (
{song &&
}
)
}