feat(ui): amp Cab selector moves to the Level·Bypass footer

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 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 12:25:22 -07:00
parent 71d9b44809
commit 415e99dd62
+34 -2
View File
@@ -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 {