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:
@@ -25,6 +25,10 @@ struct StationsView: View {
|
|||||||
@State private var pageSize = 10
|
@State private var pageSize = 10
|
||||||
@State private var visibleCount = 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 {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
List {
|
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") {
|
Section("Key") {
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
Circle().fill(.green).frame(width: 12, height: 12)
|
Circle().fill(.green).frame(width: 12, height: 12)
|
||||||
@@ -162,20 +201,16 @@ struct StationsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.refreshable {
|
.navigationTitle("Key")
|
||||||
// Manual override for the twice-a-day cache policy.
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
await onRefresh()
|
.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
|
.presentationDetents([.medium])
|
||||||
// inline title in. No custom toolbar needed — the native mechanism
|
}
|
||||||
// only renders text, which is exactly what we want here.
|
|
||||||
.navigationTitle("FuelBoard")
|
|
||||||
.navigationBarTitleDisplayMode(.large)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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")
|
||||||
|
|||||||
BIN
Binary file not shown.
@@ -3,7 +3,7 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>LastAccessedDate</key>
|
<key>LastAccessedDate</key>
|
||||||
<date>2026-08-14T21:46:07Z</date>
|
<date>2026-08-14T22:47:15Z</date>
|
||||||
<key>WorkspacePath</key>
|
<key>WorkspacePath</key>
|
||||||
<string>/Users/apt/workspace/fuelboard/FuelBoard.xcodeproj</string>
|
<string>/Users/apt/workspace/fuelboard/FuelBoard.xcodeproj</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
Reference in New Issue
Block a user