Simplify station financial verdicts

This commit is contained in:
FuelBoard Contributor
2026-10-17 19:55:55 +01:00
parent 7aaaffa1c5
commit c6e252d194
7 changed files with 94 additions and 28 deletions
+36 -2
View File
@@ -93,8 +93,8 @@ struct FuelSavingsAdjustmentView: View {
}
}
/// The colour-coded verdict capsule shared by the station listing rows, the
/// detail sheet and the compact summary.
/// The colour-coded monetary verdict capsule used by the detail sheet and other
/// full financial summaries. Listing rows use `ListingFuelSavingsCapsule`.
///
/// An HStack with an explicit spacing, NOT a Label: given the width to spare,
/// a Label lays its icon and title out across the row and leaves a visible gap
@@ -145,4 +145,38 @@ struct FuelSavingsCapsule: View {
case .baseline: return "location.circle.fill"
}
}
}
/// Amount-free, neutral verdict used by station listing rows only. Keeping this
/// separate from `FuelSavingsCapsule` preserves the detail sheet's monetary,
/// colour-coded verdict and comparison presentation.
struct ListingFuelSavingsCapsule: View {
let result: FuelSavingsResult
var body: some View {
HStack(alignment: .firstTextBaseline, spacing: 3) {
Image(systemName: symbol)
.accessibilityHidden(true)
Text(result.listingCapsuleHeadline())
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.leading)
}
.font(.caption.weight(.semibold))
.foregroundStyle(.primary)
.padding(.horizontal, 8)
.padding(.vertical, 4)
.background(Capsule().fill(Color.secondary.opacity(0.14)))
.accessibilityElement(children: .combine)
.accessibilityLabel(result.listingCapsuleHeadline())
}
private var symbol: String {
switch result.status {
case .worthTheDrive: return "checkmark.circle"
case .notWorthTheDrive: return "arrow.up.circle"
case .breakEven: return "equal.circle"
case .baseline: return "location.circle"
}
}
}