Dropzones using new mopidy actions
This commit is contained in:
@ -49,11 +49,11 @@ class Dropzones extends React.Component{
|
||||
|
||||
switch( target.action ){
|
||||
case 'enqueue':
|
||||
this.props.mopidyActions.enqueueTracks( uris )
|
||||
this.props.mopidyActions.enqueueURIs( uris )
|
||||
break
|
||||
|
||||
case 'enqueue_next':
|
||||
this.props.mopidyActions.enqueueTracksNext( uris )
|
||||
this.props.mopidyActions.enqueueURIsNext( uris )
|
||||
break
|
||||
|
||||
case 'add_to_playlist':
|
||||
|
||||
@ -89,28 +89,41 @@ class Playlist extends React.Component{
|
||||
this.props.uiActions.removeTracksFromPlaylist( this.props.playlist.uri, tracks_indexes )
|
||||
}
|
||||
|
||||
renderExtraButtons(){
|
||||
renderActions(){
|
||||
switch( helpers.uriSource( this.props.playlist.uri ) ){
|
||||
|
||||
case 'm3u':
|
||||
return (
|
||||
<span>
|
||||
<div className="actions">
|
||||
<button className="rounded primary" onClick={ e => this.play() }>Play</button>
|
||||
<button className="rounded outline" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.playlist.uri, name: this.props.playlist.name }) }>Edit</button>
|
||||
<ConfirmationButton className="rounded destructive" content="Delete" confirmingContent="Are you sure?" onConfirm={ e => this.delete() } />
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
|
||||
case 'spotify':
|
||||
if( this.props.playlist.can_edit ){
|
||||
return (
|
||||
<span>
|
||||
<div className="actions">
|
||||
<button className="rounded primary" onClick={ e => this.play() }>Play</button>
|
||||
<button className="outline rounded" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.playlist.uri, name: this.props.playlist.name, is_public: this.props.playlist.public }) }>Edit</button>
|
||||
<ConfirmationButton className="rounded destructive" content="Delete" confirmingContent="Are you sure?" onConfirm={ e => this.unfollow() } />
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
return <FollowButton className="rounded outline" uri={this.props.playlist.uri} addText="Add to library" removeText="Remove from library" is_following={this.props.playlist.is_following} />
|
||||
return (
|
||||
<div className="actions">
|
||||
<button className="rounded primary" onClick={ e => this.play() }>Play</button>
|
||||
<FollowButton className="rounded outline" uri={this.props.playlist.uri} addText="Add to library" removeText="Remove from library" is_following={this.props.playlist.is_following} />
|
||||
</div>
|
||||
)
|
||||
|
||||
default:
|
||||
return (
|
||||
<div className="actions">
|
||||
<button className="rounded primary" onClick={ e => this.play() }>Play</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,10 +162,7 @@ class Playlist extends React.Component{
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="actions">
|
||||
<button className="rounded primary" onClick={ e => this.play() }>Play</button>
|
||||
{ this.renderExtraButtons() }
|
||||
</div>
|
||||
{ this.renderActions() }
|
||||
|
||||
<section className="list-wrapper">
|
||||
{ this.props.playlist.tracks ? <TrackList tracklist_uri={this.props.params.uri} context={context} tracks={this.props.playlist.tracks} removeTracks={ tracks_indexes => this.removeTracks(tracks_indexes) } reorderTracks={ (indexes, index) => this.reorderTracks(indexes, index) } /> : null }
|
||||
|
||||
Reference in New Issue
Block a user