Remove redundant comparison mode notice
This commit is contained in:
@@ -3,7 +3,6 @@ import SwiftUI
|
|||||||
struct FuelSavingsAdjustmentView: View {
|
struct FuelSavingsAdjustmentView: View {
|
||||||
@Binding var amount: FuelSavingsFillAmount
|
@Binding var amount: FuelSavingsFillAmount
|
||||||
|
|
||||||
@State private var unitChangeNotice: String?
|
|
||||||
@State private var showingComparisonHelp = false
|
@State private var showingComparisonHelp = false
|
||||||
|
|
||||||
private var range: ClosedRange<Double> {
|
private var range: ClosedRange<Double> {
|
||||||
@@ -71,11 +70,6 @@ struct FuelSavingsAdjustmentView: View {
|
|||||||
Text("Adjust your fill-up amount for this visit. Your default won’t change.")
|
Text("Adjust your fill-up amount for this visit. Your default won’t change.")
|
||||||
.font(.caption2)
|
.font(.caption2)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
if let unitChangeNotice {
|
|
||||||
Text(unitChangeNotice)
|
|
||||||
.font(.caption2)
|
|
||||||
.foregroundStyle(.orange)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,10 +78,9 @@ struct FuelSavingsAdjustmentView: View {
|
|||||||
get: { amount.unit },
|
get: { amount.unit },
|
||||||
set: { newUnit in
|
set: { newUnit in
|
||||||
guard newUnit != amount.unit else { return }
|
guard newUnit != amount.unit else { return }
|
||||||
// No one litre figure equals a budget at every candidate price.
|
// No one litre figure equals a budget at every candidate price,
|
||||||
// A unit change starts a new, explicitly labelled comparison.
|
// so switching modes starts from that mode's configured default.
|
||||||
amount = FuelSavingsCalculator.newComparisonAmount(afterSwitching: amount, to: newUnit)
|
amount = FuelSavingsCalculator.newComparisonAmount(afterSwitching: amount, to: newUnit)
|
||||||
unitChangeNotice = "New comparison basis — adjust the \(newUnit.displayName) amount to your intended fill-up."
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user