Don't highlight sidebar Library when on /artist-detail

Cin: arriving at artist-detail from Search/Discover/Watchlist
highlighted the Library sidebar entry, which is misleading — the user
didn't navigate via Library. The hardcoded mapping was a holdover from
when artist-detail was reached only from the (now retired) Artists page.

Drop the special case so artist-detail behaves like playlist-explorer:
no [data-page] match in the sidebar, no highlight. The user's actual
origin page is already preserved on the back button.

The deep-link fallback in _getPageFromPath (artist-detail → library)
is left intact: if someone pastes /artist-detail in the URL bar with
no state to render, library is still the most sensible landing page,
and sidebar-highlighting Library in that scenario is correct because
they're literally on Library.
pull/361/head
Broque Thomas 1 month ago
parent 02f26bf338
commit 1aedc2ddcf

@ -2131,14 +2131,14 @@ function navigateToPage(pageId, options = {}) {
return;
}
// Update navigation buttons (only if there's a nav button for this page)
// Update navigation buttons (only if there's a nav button for this page).
// Pages reachable from many surfaces (artist-detail, playlist-explorer)
// intentionally have no [data-page] match here — the sidebar shouldn't
// imply a section the user didn't actually navigate via.
document.querySelectorAll('.nav-button').forEach(btn => {
btn.classList.remove('active');
});
// Handle artist-detail page specially - it should highlight the 'library' nav button
const navPageId = pageId === 'artist-detail' ? 'library' : pageId;
const navButton = document.querySelector(`[data-page="${navPageId}"]`);
const navButton = document.querySelector(`[data-page="${pageId}"]`);
if (navButton) {
navButton.classList.add('active');
}

Loading…
Cancel
Save