import React, {useEffect, useState} from 'react'
import {getArtist, getArtistDiscs} from "../services/entity_service";
import {CoverWithCaption} from './CoverArt';
import ReactJson from "react-json-view";
export const Discs = (props) => {
const discs = props.discs ? props.discs.discs : null;
const paginate = props.discs ? props.discs.paginate : null;
if (discs) {
return (
Discos
{discs.map((disc, index) => {
return (
)
})}
)
} else return <>>
}
export const Artist = (props) => {
const artist = props.artist;
if (artist) {
return (
{artist.name}
{[artist.type, artist.country].filter(Boolean).join(' - ')}
{artist.tags.map((tag, index) => (- {tag.name}
))}
)
} else {
return <>>
}
}
export const ArtistView = (props) => {
const [artist, setArtist] = useState(null);
const [discs, setDiscs] = useState(null);
const mbid = props.match.params.mbid;
useEffect(() => {
if (mbid) {
getArtist(mbid).then((result) => setArtist(result));
getArtistDiscs(mbid, 15).then((result) => setDiscs(result));
}
}, [mbid])
return (
);
}