Context menu

This commit is contained in:
James Barnsley
2019-03-19 08:08:40 +13:00
parent 5aa932d045
commit 46b8225655
5 changed files with 7964 additions and 7256 deletions

View File

@ -221,9 +221,9 @@ class ContextMenu extends React.Component{
this.props.mopidyActions.playPlaylist(this.props.menu.uris[0]);
}
enqueuePlaylist(e){
enqueuePlaylist(e, play_next = false){
this.props.uiActions.hideContextMenu();
this.props.mopidyActions.enqueuePlaylist(this.props.menu.uris[0]);
this.props.mopidyActions.enqueuePlaylist(this.props.menu.uris[0], play_next);
}
shufflePlayPlaylist(e){
@ -520,6 +520,14 @@ class ContextMenu extends React.Component{
</div>
)
var play_playlist_next = (
<div className="context-menu__item">
<a className="context-menu__item__link" onClick={e => this.enqueuePlaylist(e, true)}>
<span className="context-menu__item__label">Play next</span>
</a>
</div>
)
var add_to_playlist = (
<div className="context-menu__item context-menu__item--has-submenu">
<a className="context-menu__item__link" onClick={e => this.setSubmenu('add-to-playlist')}>
@ -702,6 +710,7 @@ class ContextMenu extends React.Component{
return (
<div>
{play_playlist}
{play_playlist_next}
{shuffle_play_playlist}
{add_playlist_to_queue}
{this.canBeInLibrary() ? <div className="context-menu__divider" /> : null}

View File

@ -650,13 +650,13 @@ const MopidyMiddleware = (function(){
// Spotify-provied playlists need to be handled by the Spotify service
// We only need to load them if we haven't already got all the tracks
if (playlist.provider == 'spotify' && playlist.tracks_total == playlist.tracks_uris.length){
store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri, action.shuffle, 'enqueue'));
store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri, action.shuffle, 'enqueue', action.play_next));
break;
}
// It's a Spotify playlist that we haven't loaded yet, so Spotify HTTP API needs to go get it
} else if (helpers.uriSource(action.uri) == 'spotify' && store.getState().spotify.enabled){
store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri, action.shuffle, 'enqueue'));
store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri, action.shuffle, 'enqueue', action.play_next));
break
}