Listing rows: verdict text hugs its icon, and the address stops repeating the name
Two things the listing row was saying twice, or too loosely.
- The verdict capsule used a Label, and a Label lays its icon and title out
across the width it is given: in a listing row that left 22pt of empty space
between the symbol and "Save £1.07 after travel". It is now an HStack with
an explicit 3pt spacing (5pt in the detail sheet), so the text sits beside its
icon and the capsule background hugs the pair. Measured on the same row: the
capsule text moved x 412 -> 341 and the pill 270-831 -> 270-691.
- The address line printed the station name a second time. The official Fuel
Finder address field usually opens with the station's own name ("CHIDSWELL
SERVICE STATION, LEEDS ROAD, DEWSBURY, WF12 7QW" for "Jet Chidswell"): 14% of
the dump's addresses start with the exact name, and 13% also end with the
postcode the row appended again. StationAddressLine (new, in Shared/, so the
row and the detail sheet share one rule) drops a leading repeat of the name
and writes the postcode exactly once.
The rules are deliberately conservative: a leading segment carrying a house
number is a real street address and is left alone ("41 ANNACLOY RD ANNACLOY"),
and a partial-word match ("Jet" against "JETSON FILLING STATION") never cuts
into a word. 14 new tests (169 total, 0 failures) pin the shapes found in the
real dump as well as the examples above.
Verified on the simulator: the first listing row's second line went from
"CHIDSWELL SERVICE STA..." to "LEEDS ROAD, DEWSBURY...", and the detail sheet
reads "Sainsbury's Halifax / WADE STREET, HX1 1SB".
This commit is contained in:
@@ -1337,7 +1337,9 @@ struct StationRow: View {
|
||||
.accessibilityLabel(notice.title)
|
||||
}
|
||||
}
|
||||
Text("\(station.address), \(station.postcode)")
|
||||
Text(StationAddressLine.display(address: station.address,
|
||||
postcode: station.postcode,
|
||||
name: station.name))
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
|
||||
@@ -160,13 +160,19 @@ struct FuelSavingsSummaryView: View {
|
||||
/// The colour-coded verdict capsule — ONE implementation for the listing rows
|
||||
/// and the detail sheet, so the verdict reads identically in both; the sheet
|
||||
/// just gets the larger font and padding.
|
||||
///
|
||||
/// 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 between them (22pt in the listing row), which read as the text having
|
||||
/// drifted away from its symbol. The icon is decorative here — the verdict
|
||||
/// is in the text — so VoiceOver reads the capsule as one phrase.
|
||||
private func capsule(for result: FuelSavingsResult, compact: Bool) -> some View {
|
||||
Label {
|
||||
HStack(spacing: compact ? 3 : 5) {
|
||||
Image(systemName: symbol(for: result.status))
|
||||
.accessibilityHidden(true)
|
||||
Text(result.capsuleHeadline())
|
||||
.lineLimit(1)
|
||||
.minimumScaleFactor(0.8)
|
||||
} icon: {
|
||||
Image(systemName: symbol(for: result.status))
|
||||
}
|
||||
.font(compact ? .caption.weight(.semibold) : .headline)
|
||||
.foregroundStyle(capsuleColor(for: result.status))
|
||||
|
||||
@@ -46,7 +46,9 @@ struct StationDetailView: View {
|
||||
}
|
||||
Section {
|
||||
LabeledContent("Name", value: station.name)
|
||||
LabeledContent("Address", value: "\(station.address), \(station.postcode)")
|
||||
LabeledContent("Address", value: StationAddressLine.display(address: station.address,
|
||||
postcode: station.postcode,
|
||||
name: station.name))
|
||||
if let location {
|
||||
let km = FuelStore.displayDistanceKM(
|
||||
station: station, userLat: location.lat, userLng: location.lng
|
||||
|
||||
Reference in New Issue
Block a user