import React, { PropTypes } from 'react'
import ReactDOM from 'react-dom'
import { Router, Link, hashHistory } from 'react-router'
import * as helpers from '../helpers'
import Icon from './Icon'
import Thumbnail from './Thumbnail'
import ArtistSentence from './ArtistSentence'
export default class GridItem extends React.Component{
constructor(props){
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);
}
}
handleContextMenu(e){
if (this.props.onContextMenu){
this.props.onContextMenu(e)
}
}
shouldComponentUpdate(nextProps, nextState){
return nextProps.item != this.props.item;
}
renderSecondary(item){
var output = ''
switch (item.type){
case 'playlist':
return (
{item.tracks_total ? item.tracks_total : 0} tracks
)
break
case 'artist':
return (
{item.followers ? item.followers.total.toLocaleString()+' followers' : null}
{item.albums_uris ? item.albums_uris.length+' albums' : null}
)
break
case 'album':
return (
{item.artists ?