From 59a2761f800947fe2ef0ae4e20a8caa74cec4410 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Sep 2026 03:41:59 +0000 Subject: [PATCH 01/10] feat: replace text toggle with an icon button + settings pop-up Closes #12. The player-controls bar previously got a "Metronome" text button that pushed raw slider/checkbox/select controls directly into the bar once enabled. Now it's a compact icon (classic metronome triangle-and-pendulum glyph) that opens a small settings pop-up (Enabled toggle, volume, flash, subdivision, count-in), dismissed on an outside click. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_016cfE1wg6F2VT6eqJEp4LBz --- README.md | 4 +- assets/plugin.css | 37 ++++++++++++- plugin.json | 2 +- screen.js | 122 +++++++++++++++++++++++++++++++++---------- tests/screen.test.js | 8 +-- 5 files changed, 139 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 553aa12..16d6703 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A plugin for [feedBack](https://github.com/got-feedback/feedback) that adds an a - **Audible click** — plays a sine tone on every beat, with a higher pitch on downbeats (measure starts) - **Visual flash** — subtle amber glow on the highway canvas on each beat (brighter on downbeats) - **Tempo-synced** — follows the song's actual beat map, including tempo changes -- **Toggle button** — click "Metronome" in the player controls to enable/disable +- **Icon button** — click the metronome icon in the player controls to open a settings pop-up (enable/disable, volume, flash, subdivision, count-in) - **Zero setup** — no configuration needed, works with any song ## Installation @@ -18,7 +18,7 @@ git clone https://github.com/got-feedback/feedback-plugin-metronome.git metronom docker compose restart ``` -A "Metronome" button will appear in the player controls bar when you play a song. +A metronome icon will appear in the player controls bar when you play a song; click it to open the settings pop-up. ## How It Works diff --git a/assets/plugin.css b/assets/plugin.css index 5ca65dd..df3cfdb 100644 --- a/assets/plugin.css +++ b/assets/plugin.css @@ -24,8 +24,16 @@ } } +.met-wrap { + position: relative; + display: inline-flex; +} + .met-btn { - padding: 0.375rem 0.75rem; + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0.375rem; border-radius: 0.5rem; font-size: 0.75rem; color: var(--met-fg); @@ -79,6 +87,33 @@ display: none !important; } +.met-popover { + position: absolute; + bottom: calc(100% + 0.5rem); + right: 0; + z-index: 30; + display: flex; + flex-direction: column; + gap: 0.5rem; + min-width: 10rem; + padding: 0.625rem; + border: 1px solid var(--met-border); + border-radius: 0.5rem; + background-color: var(--met-bg); + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); +} + +.met-row { + display: flex; + align-items: center; + gap: 0.5rem; +} + +.met-row .met-range { + flex: 1; + width: auto; +} + /* Plugin-owned elements (not host-themed classes) always get baseline styling. */ #met-count-in-overlay span { font-size: 120px; diff --git a/plugin.json b/plugin.json index 85a0426..e4eaacd 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "id": "metronome", "name": "Metronome", - "version": "1.0.1", + "version": "1.1.0", "private": false, "script": "screen.js", "styles": "assets/plugin.css", diff --git a/screen.js b/screen.js index ca1ca94..2eb44a0 100644 --- a/screen.js +++ b/screen.js @@ -157,15 +157,18 @@ function _metInjectButton() { if (!controls) return; const existingBtn = document.getElementById('btn-metronome'); if (existingBtn) { + const existingEnabledCheck = document.getElementById('met-enabled-check'); const existingSlider = document.getElementById('met-volume'); const existingFlashCheck = document.getElementById('met-flash-check'); const existingSubdivSel = document.getElementById('met-subdiv'); const existingCountInCheck = document.getElementById('met-count-in-check'); - existingBtn.onclick = _metToggle; + existingBtn.onclick = _metTogglePopover; + if (existingEnabledCheck) _metBindEnabledCheck(existingEnabledCheck); if (existingSlider) _metBindVolumeSlider(existingSlider); if (existingFlashCheck) _metBindFlashCheck(existingFlashCheck); if (existingSubdivSel) _metBindSubdivSelect(existingSubdivSel); if (existingCountInCheck) _metBindCountInCheck(existingCountInCheck); + _metInstallPopoverDismissHook(); _metSyncUi(); return; } @@ -179,44 +182,73 @@ function _metInjectButton() { else controls.appendChild(el); }; + // Issue #12: a compact icon button that toggles a small settings + // pop-up, instead of a text button that pushed raw //