Scope cheapest/RAG/TOP to alert trigger radius in app + widget; header shows 'within X km'; falls back to full fetch when radius pool empty

This commit is contained in:
FuelBoard Contributor
2026-08-11 17:21:36 +01:00
parent cde51622a3
commit 2d95c4e1d6
3 changed files with 34 additions and 6 deletions
+10 -3
View File
@@ -11,6 +11,7 @@ struct StationsView: View {
@Binding var stationLimit: Int
let cheapestPrice: Double?
let location: Coordinate?
let radiusKM: Double
let favouriteIDs: Set<String>
var onToggleFavourite: (FuelStation) -> Void = { _ in }
@@ -18,9 +19,15 @@ struct StationsView: View {
NavigationStack {
List {
Section {
Text("\(sortMode == .closest ? "Closest" : "Cheapest") \(selectedFuel.displayName) — tap a station for directions.")
.font(.footnote)
.foregroundStyle(.secondary)
if let location {
Text("\(sortMode == .closest ? "Closest" : "Cheapest") \(selectedFuel.displayName) within \(Int(radiusKM)) km — 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") {