diff --git a/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift b/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift index c0bddac..20d09d7 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift @@ -159,6 +159,18 @@ public struct PedalPaletteView: View { } } + /// The `.amp` bucket on its own, or `nil` when no amp models are visible. Split out so the + /// horizontal picker can drop the (large) amp list into the ROUTING row instead of letting it + /// stretch the head of the effects row. + private var ampGroup: (category: PedalCategory, names: [String])? { + groupedVisiblePedals.first { $0.category == .amp } + } + + /// Visible pedal groups excluding the amp models — everything the effects row shows. + private var effectGroups: [(category: PedalCategory, names: [String])] { + groupedVisiblePedals.filter { $0.category != .amp } + } + // MARK: - Body public var body: some View { @@ -191,8 +203,9 @@ public struct PedalPaletteView: View { } } - /// Horizontal scroller: a PEDALS row (leading filter + colour-coded cards) with the ROUTING - /// row stacked beneath it. + /// Horizontal scroller: a PEDALS row (leading filter + colour-coded effect cards) with a second + /// row that carries the amp models alongside the ROUTING cards. Amps live with routing rather + /// than at the head of the effects row so the effects row stays short. private var horizontalBody: some View { VStack(alignment: .leading, spacing: PedalPaletteView.sectionSpacing) { HStack(alignment: .top, spacing: PedalPaletteView.sectionSpacing) { @@ -200,7 +213,7 @@ public struct PedalPaletteView: View { sectionTitle("PEDALS") if showsFilterMenu { filterMenu } } - ForEach(groupedVisiblePedals, id: \.category) { group in + ForEach(effectGroups, id: \.category) { group in VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) { categoryLabel(group.category) HStack(alignment: .top, spacing: PedalPaletteView.rowSpacing) { @@ -211,10 +224,24 @@ public struct PedalPaletteView: View { } } } - HStack(alignment: .top, spacing: PedalPaletteView.rowSpacing) { - sectionTitle("ROUTING") - ForEach(PedalPaletteView.routingOptions, id: \.title) { option in - routingCard(title: option.title, caption: option.caption, action: option.action) + HStack(alignment: .top, spacing: PedalPaletteView.sectionSpacing) { + if let amps: (category: PedalCategory, names: [String]) = ampGroup { + VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) { + categoryLabel(amps.category) + HStack(alignment: .top, spacing: PedalPaletteView.rowSpacing) { + ForEach(amps.names, id: \.self) { name in + pedalRow(name) + } + } + } + } + VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) { + sectionTitle("ROUTING") + HStack(alignment: .top, spacing: PedalPaletteView.rowSpacing) { + ForEach(PedalPaletteView.routingOptions, id: \.title) { option in + routingCard(title: option.title, caption: option.caption, action: option.action) + } + } } } }