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
+7 -22
View File
@@ -1846,8 +1846,8 @@ struct StationRow: View {
/// styles. The mockup's divider sits at ~53% of its row; this is that ratio,
/// held per row rather than derived from the row's text — the point is that
/// the hairline, the price axis and the star cannot move as the list scrolls.
/// The price column takes the remainder, and its savings capsule scales down
/// instead of widening the column and dragging the hairline with it.
/// The price column takes the remainder, and its listing verdict wraps
/// vertically instead of widening the column and dragging the hairline.
///
/// One value for both price styles: the star used to sit at the end of the
/// price line and hold ~28pt of the price column, so the wide form `£1.58⁷/L`
@@ -1857,11 +1857,6 @@ struct StationRow: View {
/// in pounds & pence, and names keep the same room in both styles.
private static let leftSectionShare: CGFloat = 0.52
/// The comparison label sits beside the capsule only where the row is wide
/// enough for both (regular width). On an iPhone the mockup's canvas is
/// wider than the whole screen, so the label drops under the capsule rather
/// than starving the station name.
@Environment(\.horizontalSizeClass) private var sizeClass
private var ragColor: Color {
guard let price = station.prices[fuel], let baselinePrice else { return .gray }
@@ -2099,24 +2094,14 @@ struct StationRow: View {
.buttonStyle(.borderless)
}
/// The savings capsule plus the comparison it is measured against. The
/// capsule itself is the shared verdict view, so a row, the detail sheet and
/// the compact summary cannot drift apart. The comparison label sits UNDER
/// the capsule, trailing-aligned with it, at every width — beside it, a long
/// verdict pushed the caption off the row and the pair no longer read as one
/// statement.
/// Listing-only verdict. It deliberately omits money and the repeated
/// comparison caption; the full monetary result remains in More info.
@ViewBuilder
private func savingsCapsule(_ result: FuelSavingsResult) -> some View {
VStack(alignment: .trailing, spacing: 2) {
if result.status == .baseline {
FuelSavingsCapsule(result: result)
Text(FuelSavingsFormat.comparisonLabel(status: result.status))
.font(.caption2)
.foregroundStyle(.secondary)
.lineLimit(1)
// Same narrow column as the capsule above it, so the same floor:
// scaled copy, not a trimmed "vs closest st…".
.minimumScaleFactor(0.7)
.multilineTextAlignment(.trailing)
} else {
ListingFuelSavingsCapsule(result: result)
}
}