Skip to content

Commit b0e39c1

Browse files
committed
Hide "Export to Apple Music" option if user not signed into AM
We hide the "Export to Spotify" button in the playlist menu, but the logic to show/hide the Apple Music button was incorrect and the option was shown at all times.
1 parent 79fe1a9 commit b0e39c1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: frontend/js/src/playlists/components/PlaylistMenu.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ function PlaylistMenu({
219219
handleError(error.error ?? error);
220220
}
221221
};
222-
const showSpotifyExportButton = spotifyAuth?.permission?.includes(
223-
"playlist-modify-public"
224-
);
225-
const showAppleMusicExportButton = appleAuth;
222+
const isLoggedIn = Boolean(currentUser?.name);
223+
const showSpotifyExportButton =
224+
isLoggedIn && spotifyAuth?.permission?.includes("playlist-modify-public");
225+
const showAppleMusicExportButton = isLoggedIn && appleAuth?.music_user_token;
226226
return (
227227
<ul
228228
className="dropdown-menu dropdown-menu-right"
@@ -281,7 +281,9 @@ function PlaylistMenu({
281281
</li>
282282
</>
283283
)}
284-
<li role="separator" className="divider" />
284+
{(showSpotifyExportButton || showAppleMusicExportButton) && (
285+
<li role="separator" className="divider" />
286+
)}
285287
{showSpotifyExportButton && (
286288
<li>
287289
<a

0 commit comments

Comments
 (0)