Redesign the station listing and move the Best Value controls
Two columns split by a 1pt hairline: identity on the left at a fixed 52% share so rows line up when scrolling, price and savings on the right, leading-aligned on one axis with the price dominant. The favourites star sits under the station logo, freeing the width the pounds-and-pence price needs to render in full rather than scaled or truncated. Badges stay tinted rather than filled — BEST VALUE green, CHEAPEST blue, none for nearest — and the verdict capsule is one shared view across the listing, the detail sheet and the compact summary, so wording and colour cannot drift between them. Best Value's minimum saving moves from Alerts to Settings, Fuel Savings, beside the fill size and MPG that produce the saving; the Alerts tab reads it back instead of offering it twice. Its options are now 50p steps to £5 (was 50p/£1/£2/£5), so £2.50 and £3 are reachable, with a test pinning the step, the ceiling and the store's string round-trip. The verdict capsule scales to 0.7 before truncating. Measured on a 393pt screen its copy is handed ~69pt while "Closest station" needs ~90pt, so the old 0.8 floor could not reach it and rows showed "Closest stati..." instead. Verified: Debug build clean, swift test 249/249.
This commit is contained in:
+11
-11
@@ -13,7 +13,10 @@ struct AlertsView: View {
|
||||
@Binding var radius: Double // stored in km (monitor + storage)
|
||||
@Binding var fuel: FuelType // the fuel alerts monitor for
|
||||
@Binding var alertMode: AlertMode
|
||||
@Binding var bestValueThresholdGBP: Double
|
||||
/// Read-only here: the threshold is edited in Settings → Fuel Savings, where
|
||||
/// the fill size and MPG that decide the saving live. Read back so the
|
||||
/// alert's own rule is visible without leaving the tab.
|
||||
let bestValueThresholdGBP: Double
|
||||
let bestValueConfigured: Bool
|
||||
@Binding var favouriteDropEnabled: Bool
|
||||
@Binding var favouriteDropFuel: FuelType
|
||||
@@ -178,16 +181,13 @@ struct AlertsView: View {
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
if alertMode == .bestValue {
|
||||
Picker(String(localized: "Minimum saving", comment: "Best Value alert threshold picker title"), selection: $bestValueThresholdGBP) {
|
||||
ForEach(FuelStore.bestValueAlertThresholdOptionsGBP, id: \.self) { value in
|
||||
Text(FuelSavingsFormat.money(value)).tag(value)
|
||||
}
|
||||
}
|
||||
if !bestValueConfigured {
|
||||
Text(String(localized: "Set up Best Value first so FuelBoard can account for your fill size, MPG and travel cost.", comment: "Best Value alert setup hint"))
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
// The threshold is edited in Settings → Fuel Savings: it
|
||||
// labels station rows BEST VALUE as well as gating this
|
||||
// alert, so it lives with the fill size and MPG that
|
||||
// produce the saving. Read back here, not offered twice.
|
||||
Text(String(format: String(localized: "Minimum saving %@ — change in Settings, Fuel Savings.", comment: "Best Value alert threshold read-back"), FuelSavingsFormat.money(bestValueThresholdGBP)))
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
if enabled && monitoredCount == 0 {
|
||||
Text(String(localized: "No stations monitored yet — open the Stations tab to load prices first.", comment: "No monitored stations hint"))
|
||||
|
||||
Reference in New Issue
Block a user