diff --git a/BACKLOG.md b/BACKLOG.md index 85a9737..a90bc06 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -17,7 +17,7 @@ bottom as they come up. ## UX / polish - [x] Empty-state designs for empty playlists and empty history (match the new hero). - [x] Loading skeletons for search results instead of a bare "Searching…". -- [ ] Keyboard-shortcut help overlay (press `?`), listing space / arrows / f / m. +- [x] Keyboard-shortcut help overlay (press `?`), listing space / arrows / f / m. - [ ] Download/preload progress indicator on cards (percent or a bar, not just a pulse). - [ ] Remember and restore the last playback position per video. - [ ] Toast queue (stack multiple toasts instead of replacing). diff --git a/frontend/app.js b/frontend/app.js index ccc0c50..d4aa902 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -944,7 +944,24 @@ function deletePlaylist(pl) { ]); } -// ---------- Modal ---------- +// ============================================================================ +// Keyboard shortcut help overlay +// ============================================================================ +function toggleShortcutHelp() { + const overlay = $('shortcutHelp'); + overlay.classList.toggle('hidden'); +} + +function wireShortcutHelp() { + $('shortcutClose').addEventListener('click', () => $('shortcutHelp').classList.add('hidden')); + $('shortcutHelp').addEventListener('click', (e) => { + if (e.target.id === 'shortcutHelp') $('shortcutHelp').classList.add('hidden'); + }); +} + +// ============================================================================ +// Modal +// ============================================================================ function showModal(title, bodyNode, actions) { $('modalTitle').textContent = title; const body = $('modalBody'); @@ -1087,6 +1104,8 @@ function wireUI() { else if (e.code === 'ArrowLeft') Player.seek(Math.max(0, Player.master.currentTime - 5)); else if (e.key === 'f') els.fsBtn.click(); else if (e.key === 'm') els.muteBtn.click(); + else if (e.key === '?') toggleShortcutHelp(); + else if (e.key === 'Escape' && !$('shortcutHelp').classList.contains('hidden')) { $('shortcutHelp').classList.add('hidden'); } }); $('modal').addEventListener('click', (e) => { if (e.target.id === 'modal') closeModal(); }); @@ -1098,6 +1117,7 @@ function wireUI() { async function boot() { wirePlayerEvents(); wireUI(); + wireShortcutHelp(); try { const loaded = await API.loadData(); if (loaded && typeof loaded === 'object') { diff --git a/frontend/index.html b/frontend/index.html index 1248978..20a8b5a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -164,6 +164,25 @@
+ + +