Stations: move price-rating Key (legend) into a modal sheet opened by an info button in the nav header; list stays focused on stations. Sheet = medium detent, inline nav title 'Key', Done button; legend rows unchanged. Adds -showKeySheet launch arg (QA hook for sim).

This commit is contained in:
FuelBoard Contributor
2026-08-14 23:53:02 +01:00
parent 75506b48b7
commit bb6ee33254
13 changed files with 71 additions and 36 deletions
+47 -12
View File
@@ -25,6 +25,10 @@ struct StationsView: View {
@State private var pageSize = 10
@State private var visibleCount = 10
/// Price-rating legend (the "Key") lives in a sheet, opened from the
/// info button in the header keeps the list focused on stations.
@State private var showKey = false
var body: some View {
NavigationStack {
List {
@@ -127,6 +131,41 @@ struct StationsView: View {
}
}
}
.refreshable {
// Manual override for the twice-a-day cache policy.
await onRefresh()
}
.onChange(of: stations) { _, _ in
// New fetch or filter switch back to the first page.
visibleCount = pageSize
}
// Native large-title behaviour (Mail-style): the system shows the
// large title at rest, scrolls it away and fades the compact
// inline title in. No custom toolbar needed the native mechanism
// only renders text, which is exactly what we want here.
.navigationTitle("FuelBoard")
.navigationBarTitleDisplayMode(.large)
.onAppear {
// QA hook: launch with `-showKeySheet` to verify the legend
// sheet without driving a tap (simctl has no tap command).
if ProcessInfo.processInfo.arguments.contains("-showKeySheet") {
showKey = true
}
}
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button {
showKey = true
} label: {
Image(systemName: "info.circle")
}
.accessibilityLabel("Key")
}
}
.sheet(isPresented: $showKey) {
NavigationStack {
List {
Section("Key") {
HStack(spacing: 8) {
Circle().fill(.green).frame(width: 12, height: 12)
@@ -162,20 +201,16 @@ struct StationsView: View {
}
}
}
.refreshable {
// Manual override for the twice-a-day cache policy.
await onRefresh()
.navigationTitle("Key")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("Done") { showKey = false }
}
.onChange(of: stations) { _, _ in
// New fetch or filter switch back to the first page.
visibleCount = pageSize
}
// Native large-title behaviour (Mail-style): the system shows the
// large title at rest, scrolls it away and fades the compact
// inline title in. No custom toolbar needed the native mechanism
// only renders text, which is exactly what we want here.
.navigationTitle("FuelBoard")
.navigationBarTitleDisplayMode(.large)
}
.presentationDetents([.medium])
}
}
}
}
@@ -1 +1 @@
1786743969.454457: Module build session file for module cache at Path(_str: "/Users/apt/workspace/fuelboard/build-sim/ModuleCache.noindex")
1786747638.063251: Module build session file for module cache at Path(_str: "/Users/apt/workspace/fuelboard/build-sim/ModuleCache.noindex")
+1 -1
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>LastAccessedDate</key>
<date>2026-08-14T21:46:07Z</date>
<date>2026-08-14T22:47:15Z</date>
<key>WorkspacePath</key>
<string>/Users/apt/workspace/fuelboard/FuelBoard.xcodeproj</string>
</dict>