From 415e99dd620488057d71fd4a0561fa0d1c2d6425 Mon Sep 17 00:00:00 2001 From: Joshua Parmenter Date: Mon, 3 Aug 2026 12:25:22 -0700 Subject: [PATCH] =?UTF-8?q?feat(ui):=20amp=20Cab=20selector=20moves=20to?= =?UTF-8?q?=20the=20Level=C2=B7Bypass=20footer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For a pedal that hides the Mix knob and publishes exactly one selector (the amps, whose only selector is Cab), surface that selector in the bottom row's trailing slot beside Level and Bypass — a compact "Level · Bypass · Cab" footer — instead of a full-width selector row of its own. The rebuildsOnChange → pedalRebuildAction wiring is preserved. Pedals that show Mix (e.g. Cabinet) keep Mix there and their selector in the row; pedals with 0 or >1 selectors are unchanged. UI-only. Co-Authored-By: Claude Opus 4.8 --- Sources/LyrebirdShoeGazeUI/PedalView.swift | 36 ++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Sources/LyrebirdShoeGazeUI/PedalView.swift b/Sources/LyrebirdShoeGazeUI/PedalView.swift index efef345..ce46106 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalView.swift @@ -778,9 +778,24 @@ public struct PedalView: View { /// Row of stepped selector knobs drawn from `pedal.effectSelectors`, beneath the knob grid. /// Renders nothing when the pedal publishes no selectors. + /// A pedal that hides the Mix knob (e.g. an amp) and publishes exactly one selector surfaces + /// that selector in the bottom row beside Level/Bypass — giving the amps a compact + /// `Level · Bypass · Cab` footer — instead of a full-width selector row of its own. + private var footerSelector: PedalSelectorKnob? { + guard !pedal.showsMixControl else { return nil } + let selectors: [PedalSelectorKnob] = pedal.effectSelectors + return selectors.count == 1 ? selectors.first : nil + } + + /// Selectors rendered in their own row above the switches — everything except one promoted to + /// the bottom-row footer via ``footerSelector``. + private var inlineSelectors: [PedalSelectorKnob] { + footerSelector == nil ? pedal.effectSelectors : [] + } + @ViewBuilder private var selectorRow: some View { - let selectors: [PedalSelectorKnob] = pedal.effectSelectors + let selectors: [PedalSelectorKnob] = inlineSelectors if !selectors.isEmpty { HStack(alignment: .top, spacing: PedalView.knobRowItemSpacing) { Spacer(minLength: 0) @@ -917,11 +932,28 @@ public struct PedalView: View { HStack(alignment: .center, spacing: PedalView.bottomControlsSpacing) { levelControl bypassControl - mixControl + footerTrailing } .frame(maxWidth: .infinity) } + /// The trailing slot of the bottom row: the Mix knob when the pedal shows one, otherwise the + /// promoted ``footerSelector`` (e.g. an amp's Cab) — giving amps `Level · Bypass · Cab`. Empty + /// when neither applies, which keeps Bypass centred. + @ViewBuilder + private var footerTrailing: some View { + if pedal.showsMixControl { + mixControl + } else if let selector: PedalSelectorKnob = footerSelector { + PedalSelectorKnobView( + selector, + onCommit: selector.rebuildsOnChange + ? { [pedal, pedalRebuildAction] in pedalRebuildAction(pedal) } + : nil + ) + } + } + /// The `Level` knob — the last entry of `pedal.knobs` — placed left of the bypass switch. @ViewBuilder private var levelControl: some View {