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 {
List(selection: $state.tab) {
List {
Section("Measurements") {
Label("EIS", systemImage: "waveform.path.ecg")
.tag(Tab.eis)
Label("LSV", systemImage: "chart.xyaxis.line")
.tag(Tab.lsv)
Label("Amperometry", systemImage: "bolt.fill")
.tag(Tab.amp)
Label("Chlorine", systemImage: "drop.fill")
.tag(Tab.chlorine)
Label("pH", systemImage: "scalemass")
.tag(Tab.ph)
sidebarButton(.eis, "EIS", "waveform.path.ecg")
sidebarButton(.lsv, "LSV", "chart.xyaxis.line")
sidebarButton(.amp, "Amperometry", "bolt.fill")
sidebarButton(.chlorine, "Chlorine", "drop.fill")
sidebarButton(.ph, "pH", "scalemass")
}
Section("Data") {
Label("Sessions", systemImage: "folder")
.tag(Tab.sessions)
sidebarButton(.sessions, "Sessions", "folder")
}
Section {
cleanControls
@ -55,6 +49,15 @@ struct ContentView: View {
.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 {
VStack(alignment: .leading, spacing: 6) {
Text("Electrode Clean")