Keep favorites reachable with the bar hidden
The favorites bar carries the "Browse all" button and the sort control, so switching the bar off in settings hid the way in to both. The command palette now offers "Browse favorites" (or "Back to videos") and each sort order, and opening the grid re-renders the bar so its header -- the way back out -- is mounted even when settings say hidden. Tests (scratchpad): a new palette test that starts with the bar switched off, opens the grid through the palette, re-sorts through it, and returns to the listing. It caught the second half of this: opening from the palette did not re-render the bar, leaving no visible way out. Also fixes the favorites playback test, which had been wedging headless Chrome all session. It was reloading by navigating to the URL already loaded; the first evaluate after that is answered by the outgoing execution context and every one after it hangs forever. It now does its second visit in a fresh tab -- localStorage is shared per origin, so it models "next day" the same way -- and asserts what it had only been printing. It also runs hermetically now (no favorites left over from another test, CDN icons and fonts blocked) and no longer runs its whole body on import, which is what made it hijack a debugging session earlier. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QBDkEXP4htyXTCZUwMLphd
This commit is contained in:
@@ -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'); } });
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user