import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import LazyLoadListener from '../components/LazyLoadListener' import Header from '../components/Header' import TrackList from '../components/TrackList' import AlbumGrid from '../components/AlbumGrid' import Thumbnail from '../components/Thumbnail' import Parallax from '../components/Parallax' import ArtistList from '../components/ArtistList' import * as spotifyActions from '../services/spotify/actions' class Artist extends React.Component{ constructor(props) { super(props); } // on render componentDidMount(){ this.props.spotifyActions.getArtist( this.props.params.uri ); } // when props changed componentWillReceiveProps( nextProps ){ if( nextProps.params.uri != this.props.params.uri ){ this.props.spotifyActions.getArtist( nextProps.params.uri ); } } loadMore(){ if( !this.props.spotify.artist_albums || !this.props.spotify.artist_albums.next ) return this.props.spotifyActions.getURL( this.props.spotify.artist_albums.next, 'SPOTIFY_ARTIST_ALBUMS_LOADED_MORE' ); } render(){ if( this.props.spotify.artist ){ return (
{ this.props.spotify.artist.followers.total.toLocaleString() } followers