import SwiftUI /// The More info sheet's price-age row. /// /// Station-level by design: the relay publishes a single `price_updated` per /// station (the newest grade it maps), so the copy says "Price updated" and /// never claims the selected grade itself was updated. /// /// Past `FuelPriceFreshness.outdatedAge` a discreet note flags the information /// as possibly out of date. It is informational only — it gates nothing, and /// the station's own price row above it is unaffected. /// /// Its own view rather than inlined into `StationDetailView`: that body sits at /// the compiler's type-checking limit, so one extra statement there fails the /// build. One statement here, one there. struct StationPriceAgeView: View { let assessment: FuelPriceFreshness.Assessment /// The More info sheet's facts row prints this under the fuel price inside a /// half-width column, where a `LabeledContent`'s label + value pair cannot /// fit on one line. Compact keeps the SAME words in one caption line. var compact: Bool = false var body: some View { VStack(alignment: .leading, spacing: 2) { if compact { Text("Price updated \(assessment.updateAgeLabel)") .font(.caption2) .foregroundStyle(.secondary) .monospacedDigit() .lineLimit(1) .minimumScaleFactor(0.75) .accessibilityLabel("Price updated \(assessment.updateAgeLabel)") } else { LabeledContent("Price updated", value: assessment.updateAgeLabel) .monospacedDigit() } if let notice = assessment.outdatedNotice { Text(notice) .font(.caption2) .foregroundStyle(.secondary) .accessibilityLabel(notice) } } } }