Beginning context menus

This commit is contained in:
James Barnsley
2017-02-27 07:31:58 +13:00
parent 9bcc0adbc6
commit f5fcaee5eb
2 changed files with 12 additions and 4 deletions

View File

@ -40,10 +40,11 @@ const sendRequest = ( dispatch, getState, endpoint, method = 'GET', data = false
},
(xhr, status, error) => {
var message = xhr.responseText
if (error.error && error.error.message) message = error.error.message
dispatch(uiActions.createNotification(message,'bad'))
var response = JSON.parse(xhr.responseText)
if (response.error && response.error.message) message = response.error.message
console.error( endpoint+' failed', xhr.responseText)
dispatch(uiActions.createNotification('Spotify: '+message,'bad'))
console.error( endpoint+' failed', response)
reject(error)
}
)

View File

@ -186,6 +186,9 @@ class Artist extends React.Component{
}
if (this.props.artist){
var can_play_radio = (scheme == 'spotify')
var can_follow = (scheme == 'spotify')
return (
<div className="view artist-view">
@ -198,7 +201,11 @@ class Artist extends React.Component{
<div className="liner">
<Thumbnail image={image} circle />
<h1>{this.props.artist ? this.props.artist.name : null}</h1>
{ scheme == 'spotify' ? <div className="actions"><button className="primary" onClick={e => this.props.pusherActions.startRadio([this.props.artist.uri])}>Start radio</button><FollowButton className="white" uri={this.props.params.uri} removeText="Unfollow" addText="Follow" is_following={this.props.artist.is_following} /></div> : null}
<div className="actions">
{ can_play_radio ? <button className="primary" onClick={e => this.props.pusherActions.startRadio([this.props.artist.uri])}>Start radio</button> : null}
{ can_follow ? <FollowButton className="white" uri={this.props.params.uri} removeText="Unfollow" addText="Follow" is_following={this.props.artist.is_following} /> : null}
<button>...</button>
</div>
{ this.renderSubViewMenu() }
</div>
</div>