Stations tab: explainer moved below the list with N/TOTAL station count
The header section was removed entirely — the tab now opens with Fuel type. The explainer lives as a section footer at the bottom of the tab: - Cheapest: 'Cheapest Unleaded within 5 miles — 46/8022 stations updated · tap a station for directions.' - Closest: 'Closest Unleaded stations — nearest first, best value within 5 miles · 46/8022 stations updated' - no-location variant keeps mode + tap-for-directions hint Numerator = stations in the current list pool (as before); denominator = full UK station total from the last chain fetch (loadStationCount, 8,022 mirror snapshot) — ratio hidden until the first fetch lands.
This commit is contained in:
@@ -29,27 +29,33 @@ struct StationsView: View {
|
|||||||
/// info button in the header — keeps the list focused on stations.
|
/// info button in the header — keeps the list focused on stations.
|
||||||
@State private var showKey = false
|
@State private var showKey = false
|
||||||
|
|
||||||
|
/// Bottom-of-tab explainer (moved from the top 2026-08-16): mode/radius/
|
||||||
|
/// directions context + "N/TOTAL stations updated". The numerator is the
|
||||||
|
/// current list pool; the denominator is the full UK station total from
|
||||||
|
/// the last chain fetch (8,022 mirror snapshot) — hidden until known.
|
||||||
|
private var footerCaption: String {
|
||||||
|
let miles = distanceUnit.displayMiles(stationLimit)
|
||||||
|
let unit = distanceUnit.label(for: Double(miles))
|
||||||
|
let fuel = selectedFuel.displayName
|
||||||
|
let mode = sortMode == .closest ? "Closest" : "Cheapest"
|
||||||
|
let ratio: String
|
||||||
|
if let total = FuelStore.loadStationCount() {
|
||||||
|
ratio = "\(totalCount)/\(total)"
|
||||||
|
} else {
|
||||||
|
ratio = "\(totalCount)"
|
||||||
|
}
|
||||||
|
if let location {
|
||||||
|
if sortMode == .closest {
|
||||||
|
return "\(mode) \(fuel) stations — nearest first, best value within \(miles) \(unit) · \(ratio) stations updated"
|
||||||
|
}
|
||||||
|
return "\(mode) \(fuel) within \(miles) \(unit) — \(ratio) stations updated · tap a station for directions."
|
||||||
|
}
|
||||||
|
return "\(mode) \(fuel) — \(ratio) stations updated · tap a station for directions."
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
List {
|
List {
|
||||||
Section {
|
|
||||||
if let location {
|
|
||||||
if sortMode == .closest {
|
|
||||||
Text("Closest \(selectedFuel.displayName) stations — nearest first, best value within \(distanceUnit.displayMiles(stationLimit)) \(distanceUnit.label(for: Double(distanceUnit.displayMiles(stationLimit)))) · \(totalCount) stations")
|
|
||||||
.font(.footnote)
|
|
||||||
.foregroundStyle(.secondary)
|
|
||||||
} else {
|
|
||||||
Text("Cheapest \(selectedFuel.displayName) within \(distanceUnit.displayMiles(stationLimit)) \(distanceUnit.label(for: Double(distanceUnit.displayMiles(stationLimit)))) — \(totalCount) stations · tap a station for directions.")
|
|
||||||
.font(.footnote)
|
|
||||||
.foregroundStyle(.secondary)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("\(sortMode == .closest ? "Closest" : "Cheapest") \(selectedFuel.displayName) — tap a station for directions.")
|
|
||||||
.font(.footnote)
|
|
||||||
.foregroundStyle(.secondary)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Section("Fuel type") {
|
Section("Fuel type") {
|
||||||
FuelTypeSegmentedPicker(selection: $selectedFuel) { newValue in
|
FuelTypeSegmentedPicker(selection: $selectedFuel) { newValue in
|
||||||
FuelStore.saveSelectedFuel(newValue)
|
FuelStore.saveSelectedFuel(newValue)
|
||||||
@@ -131,6 +137,17 @@ struct StationsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bottom-of-tab explainer (moved from the top 2026-08-16):
|
||||||
|
// own section so the type-checker isn't asked to type the
|
||||||
|
// full stations section AND its footer in one expression.
|
||||||
|
Section {
|
||||||
|
EmptyView()
|
||||||
|
} footer: {
|
||||||
|
Text(footerCaption)
|
||||||
|
.font(.footnote)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.refreshable {
|
.refreshable {
|
||||||
// Manual override for the twice-a-day cache policy.
|
// Manual override for the twice-a-day cache policy.
|
||||||
|
|||||||
Reference in New Issue
Block a user