import React, { Component, PropTypes } from "react"; import CSSModules from "react-css-modules"; import { defineMessages, FormattedMessage } from "react-intl"; import FontAwesome from "react-fontawesome"; import Immutable from "immutable"; import { messagesMap } from "../utils/"; import { AlbumRow } from "./Album"; import commonMessages from "../locales/messagesDescriptors/common"; import css from "../styles/Artist.scss"; const artistMessages = defineMessages(messagesMap(Array.concat([], commonMessages))); class ArtistCSS extends Component { render () { const loading = (

); if (!this.props.artist) { // Loading return loading; } let albumsRows = []; const { albums, songs } = this.props; const artistAlbums = this.props.artist.get("albums"); if (albums && songs && artistAlbums && artistAlbums.size > 0) { this.props.artist.get("albums").forEach(function (album) { album = albums.get(album); const albumSongs = album.get("tracks").map( id => songs.get(id) ); albumsRows.push(); }); } else { // Loading albumsRows = loading; } return (

{this.props.artist.get("name")}


{this.props.artist.get("summary")}

{this.props.artist.get("name")}/

{ albumsRows }
); } } ArtistCSS.propTypes = { isFetching: PropTypes.bool.isRequired, artist: PropTypes.instanceOf(Immutable.Map), albums: PropTypes.instanceOf(Immutable.Map), songs: PropTypes.instanceOf(Immutable.Map) }; export default CSSModules(ArtistCSS, css);