diff --git a/frontend/js/enhance.js b/frontend/js/enhance.js index 45540c5..17919cb 100644 --- a/frontend/js/enhance.js +++ b/frontend/js/enhance.js @@ -151,6 +151,26 @@ App.enhance = App.enhance || {}; if (App.virtualGrid && App.virtualGrid.relayout) App.virtualGrid.relayout(); }}); out.push({ label: 'Toggle Reels view', hint: 'Playback', run: () => { if (App.feed) App.feed.toggle(); } }); + + // The favorites bar carries these controls, but it can be switched + // off in settings -- in which case the palette is the way in. + if (App.favoritesView && App.favorites) { + const browsing = App.favoritesView.isActive(); + out.push({ + label: browsing ? 'Back to videos' : 'Browse favorites', + hint: browsing ? 'Leave the favorites grid' : 'All favorites as a grid', + run: () => App.favoritesView.toggle() + }); + const currentSort = App.favorites.getSort(); + App.favorites.SORTS.forEach((sort) => { + if (sort.id === currentSort) return; + out.push({ + label: `Sort favorites: ${sort.label}`, + hint: 'Favorites', + run: () => App.favoritesView.applySort(sort.id) + }); + }); + } out.push({ label: 'Reload channel', hint: 'Refresh the current feed', run: () => { if (App.videos) App.videos.resetAndReload(); } }); out.push({ label: 'Open Menu', hint: 'Source · channel · filters', run: () => { if (App.ui) App.ui.toggleDrawer('menu'); } }); out.push({ label: 'Open Settings', hint: 'Preferences', run: () => { if (App.ui) App.ui.toggleDrawer('settings'); } }); diff --git a/frontend/js/favorites.js b/frontend/js/favorites.js index 21d883a..2862614 100644 --- a/frontend/js/favorites.js +++ b/frontend/js/favorites.js @@ -289,7 +289,10 @@ App.favorites = App.favorites || {}; list.innerHTML = ""; barPage.items = favorites; barPage.rendered = 0; - appendBarPage(list); + // While the favorites grid is open the strip is hidden -- the grid is + // the same list, larger -- so don't build cards nobody can see. The + // header stays, because it carries the way back out. + if (!browsing) appendBarPage(list); // Assignment rather than addEventListener: renderBar runs on every // favorite change, and this must not stack up handlers. diff --git a/frontend/js/favoritesView.js b/frontend/js/favoritesView.js index a44d517..90f8cda 100644 --- a/frontend/js/favoritesView.js +++ b/frontend/js/favoritesView.js @@ -59,6 +59,10 @@ App.favoritesView = App.favoritesView || {}; view.offset = 0; state.hasNextPage = true; document.body.classList.add('favorites-view-open'); + // Re-render the bar so it re-decides whether to be mounted: hidden in + // settings or not, its header has to be on screen now, since that's + // where the way back out lives (the palette can open this view too). + App.favorites.renderBar(); App.favoritesView.syncControls(); App.favoritesView.loadNext(); window.scrollTo({ top: 0, behavior: 'auto' }); @@ -71,6 +75,8 @@ App.favoritesView = App.favoritesView || {}; view.queue = []; view.offset = 0; document.body.classList.remove('favorites-view-open'); + // Back to whatever the settings say, and with its cards built again. + App.favorites.renderBar(); App.favoritesView.syncControls(); // Back to the channel listing, unless the caller is about to load // something itself (a search, a channel switch).