Unify disabled states and preserve station verdicts

This commit is contained in:
FuelBoard Contributor
2026-10-17 18:22:55 +01:00
parent ff6cbbe07d
commit 7111ce38af
6 changed files with 77 additions and 83 deletions
+9 -8
View File
@@ -105,25 +105,26 @@ struct FuelSavingsCapsule: View {
let result: FuelSavingsResult
var compact: Bool = true
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
var body: some View {
HStack(spacing: compact ? 3 : 5) {
Image(systemName: Self.symbol(for: result.status))
.accessibilityHidden(true)
Text(result.capsuleHeadline())
.lineLimit(1)
// Measured on a 393pt screen: the capsule is handed ~101pt, of
// which the icon, its spacing and the 8pt padding either side
// take 32pt, leaving ~69pt for the text. "Closest station" needs
// ~90pt at full size, so a 0.8 floor — 72pt — could not reach it
// and the row showed "Closest stati…" instead. 0.7 leaves ~63pt,
// which clears it at ~10pt type: scaled, never truncated.
.minimumScaleFactor(0.7)
// Financial verdicts stay complete and single-line at ordinary
// text sizes. Accessibility sizes may use a second line rather
// than clipping, shrinking or losing the amount to an ellipsis.
.lineLimit(dynamicTypeSize.isAccessibilitySize ? 2 : 1)
.fixedSize(horizontal: !dynamicTypeSize.isAccessibilitySize,
vertical: true)
}
.font(compact ? .caption.weight(.semibold) : .headline)
.foregroundStyle(Self.color(for: result.status))
.padding(.horizontal, compact ? 8 : 12)
.padding(.vertical, compact ? 4 : 7)
.background(Capsule().fill(Self.color(for: result.status).opacity(0.15)))
.accessibilityElement(children: .combine)
}
/// Verdict colour: green save, red worse off, grey break even, blue