diff --git a/FuelBoard/StationsView.swift b/FuelBoard/StationsView.swift index 1c952a0..20d4b76 100644 --- a/FuelBoard/StationsView.swift +++ b/FuelBoard/StationsView.swift @@ -29,27 +29,33 @@ struct StationsView: View { /// info button in the header — keeps the list focused on stations. @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 { NavigationStack { 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") { FuelTypeSegmentedPicker(selection: $selectedFuel) { newValue in 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 { // Manual override for the twice-a-day cache policy.