Revert station capsule layout changes

This commit is contained in:
FuelBoard Contributor
2026-10-17 18:31:45 +01:00
parent 7111ce38af
commit 7aaaffa1c5
2 changed files with 39 additions and 26 deletions
+8 -9
View File
@@ -105,26 +105,25 @@ 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())
// 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)
.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)
}
.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