From 2811cbbfba2406e7b8faf21032624563c252cda3 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Fri, 23 Nov 2018 08:20:48 +1300 Subject: [PATCH] Applying loader for context menu library checks --- src/js/components/ContextMenu.js | 24 ++++++++++++++++++++++++ src/js/views/library/LibraryTracks.js | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/js/components/ContextMenu.js b/src/js/components/ContextMenu.js index 0c203397..f60b6e9c 100755 --- a/src/js/components/ContextMenu.js +++ b/src/js/components/ContextMenu.js @@ -530,6 +530,30 @@ class ContextMenu extends React.Component{ ) + if (!this.props.spotify_authorized){ + var toggle_in_library = null; + } else if (helpers.isLoading(this.props.load_queue,['spotify_me/tracks/contains','spotify_me/playlists/contains','spotify_me/albums/contains','spotify_me/artists/contains'])){ + var toggle_in_library = ( +
+ + + Add to library + + +
+ ) + } else { + var toggle_in_library = ( +
+ this.toggleInLibrary(e, context.in_library)}> + + {context.in_library ? 'Remove from library' : 'Add to library'} + + +
+ ) + } + if (!this.props.lastfm_authorized){ var toggle_loved = null; } else if (helpers.isLoading(this.props.load_queue,['lastfm_track.getInfo'])){ diff --git a/src/js/views/library/LibraryTracks.js b/src/js/views/library/LibraryTracks.js index 9030ae26..e62a3659 100755 --- a/src/js/views/library/LibraryTracks.js +++ b/src/js/views/library/LibraryTracks.js @@ -46,7 +46,9 @@ class LibraryTracks extends React.Component{ } render(){ - if (helpers.isLoading(this.props.load_queue,['spotify_me/tracks'])){ + + // Note trailing "?" makes sure our context menu in_library checks doesn't interfere + if (helpers.isLoading(this.props.load_queue,['spotify_me/tracks?'])){ return (