cue-ios: fix List selection unavailable on iOS — use button-based sidebar

This commit is contained in:
jess 2026-03-31 18:33:20 -07:00
parent 019723d245
commit 0ff998c82c
1 changed files with 16 additions and 13 deletions

View File

@ -30,22 +30,16 @@ struct ContentView: View {
} }
private var sidebar: some View { private var sidebar: some View {
List(selection: $state.tab) { List {
Section("Measurements") { Section("Measurements") {
Label("EIS", systemImage: "waveform.path.ecg") sidebarButton(.eis, "EIS", "waveform.path.ecg")
.tag(Tab.eis) sidebarButton(.lsv, "LSV", "chart.xyaxis.line")
Label("LSV", systemImage: "chart.xyaxis.line") sidebarButton(.amp, "Amperometry", "bolt.fill")
.tag(Tab.lsv) sidebarButton(.chlorine, "Chlorine", "drop.fill")
Label("Amperometry", systemImage: "bolt.fill") sidebarButton(.ph, "pH", "scalemass")
.tag(Tab.amp)
Label("Chlorine", systemImage: "drop.fill")
.tag(Tab.chlorine)
Label("pH", systemImage: "scalemass")
.tag(Tab.ph)
} }
Section("Data") { Section("Data") {
Label("Sessions", systemImage: "folder") sidebarButton(.sessions, "Sessions", "folder")
.tag(Tab.sessions)
} }
Section { Section {
cleanControls cleanControls
@ -55,6 +49,15 @@ struct ContentView: View {
.listStyle(.sidebar) .listStyle(.sidebar)
} }
private func sidebarButton(_ tab: Tab, _ title: String, _ icon: String) -> some View {
Button {
state.tab = tab
} label: {
Label(title, systemImage: icon)
}
.listRowBackground(state.tab == tab ? Color.accentColor.opacity(0.2) : nil)
}
private var cleanControls: some View { private var cleanControls: some View {
VStack(alignment: .leading, spacing: 6) { VStack(alignment: .leading, spacing: 6) {
Text("Electrode Clean") Text("Electrode Clean")