this.handleContextMenu(e,artist)}>
-
-
- {artist.name}
-
-
- {this.props.show_source_icon ? : null}
- {artist.followers ? artist.followers.total.toLocaleString()+' followers' : null}
- {artist.albums_uris && !artist.followers ? artist.albums_uris.length+' albums' : null}
-
-
+ item={artist}
+ show_source_icon={this.props.show_source_icon}
+ onClick={e => {hashHistory.push(global.baseURL+'artist/'+encodeURIComponent(artist.uri))}}
+ onLoad={() => this.handleLoad(artist.uri)}
+ lastfmActions={this.props.lastfmActions}
+ onContextMenu={e => this.handleContextMenu(e,artist)}
+ />
)
}
)
@@ -73,7 +69,8 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = (dispatch) => {
return {
- uiActions: bindActionCreators(uiActions, dispatch)
+ uiActions: bindActionCreators(uiActions, dispatch),
+ lastfmActions: bindActionCreators(lastfmActions, dispatch)
}
}
diff --git a/src/js/components/GridItem.js b/src/js/components/GridItem.js
index 9acac3cf..c6376ddd 100755
--- a/src/js/components/GridItem.js
+++ b/src/js/components/GridItem.js
@@ -14,6 +14,16 @@ export default class GridItem extends React.Component{
super(props)
}
+ componentDidMount(){
+ if (this.props.item && !this.props.item.images){
+ switch (this.props.item.type){
+ case 'artist':
+ this.props.lastfmActions.getArtist(this.props.item.uri, this.props.item.name);
+ break;
+ }
+ }
+ }
+
handleClick(e){
if (this.props.onClick && e.target.tagName.toLowerCase() !== 'a'){
this.props.onClick(e)
@@ -27,7 +37,7 @@ export default class GridItem extends React.Component{
}
shouldComponentUpdate(nextProps, nextState){
- return nextProps.item != this.props.item
+ return nextProps.item != this.props.item;
}
renderSecondary(item){
@@ -46,7 +56,8 @@ export default class GridItem extends React.Component{
case 'artist':
return (