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 {