this.addToQueue(e)}>
@@ -463,6 +476,7 @@ class ContextMenu extends React.Component{
case 'artist':
return (
+ {context.source == 'spotify' ? play_artist_top_tracks : null}
{start_radio}
{context.source == 'spotify' ? go_to_recommendations : null}
{copy_uris}
diff --git a/src/js/services/spotify/actions.js b/src/js/services/spotify/actions.js
index d03e1766..9a0faf5c 100755
--- a/src/js/services/spotify/actions.js
+++ b/src/js/services/spotify/actions.js
@@ -1,5 +1,6 @@
var uiActions = require('../../services/ui/actions')
+var mopidyActions = require('../../services/mopidy/actions')
var lastfmActions = require('../../services/lastfm/actions')
var helpers = require('../../helpers')
@@ -912,6 +913,27 @@ export function getLibraryArtists(){
}
+export function playArtistTopTracks(uri){
+ return (dispatch, getState) => {
+ const artists = getState().ui.artists
+
+ // Do we have this artist (and their tracks) in our index already?
+ if (typeof(artists[uri]) !== 'undefined' && typeof(artists[uri].tracks) !== 'undefined'){
+ const uris = helpers.asURIs(artists[uri].tracks)
+ dispatch(mopidyActions.playURIs(uris, uri))
+
+ // We need to load the artist's top tracks first
+ } else {
+ sendRequest( dispatch, getState, 'artists/'+ helpers.getFromUri('artistid', uri) +'/top-tracks?country='+getState().spotify.country )
+ .then( response => {
+ const uris = helpers.asURIs(response.tracks)
+ dispatch(mopidyActions.playURIs(uris, uri))
+ })
+ }
+ }
+}
+
+
/**
* =============================================================== USER(S) ==============
diff --git a/src/js/views/Artist.js b/src/js/views/Artist.js
index 021feef7..7fe5a828 100755
--- a/src/js/views/Artist.js
+++ b/src/js/views/Artist.js
@@ -31,7 +31,7 @@ class Artist extends React.Component{
}
componentDidMount(){
- this.loadArtist();
+ this.loadArtist()
}
componentWillReceiveProps( nextProps ){