Station name fills row width (logo left, price pinned right, wraps); fix Favourites alert wording

This commit is contained in:
FuelBoard Contributor
2026-08-11 15:24:52 +01:00
parent 60d25164d6
commit 3da5de6da2
2 changed files with 32 additions and 24 deletions
+24 -16
View File
@@ -210,11 +210,14 @@ struct StationRow: View {
.overlay(Circle().stroke(Color.primary.opacity(0.08), lineWidth: 1)) .overlay(Circle().stroke(Color.primary.opacity(0.08), lineWidth: 1))
.shadow(color: .black.opacity(0.08), radius: 2, y: 1) .shadow(color: .black.opacity(0.08), radius: 2, y: 1)
VStack(alignment: .leading, spacing: 2) { // Name line fills the whole row width (only the logo is to its
HStack(spacing: 6) { // left); long names wrap instead of being cut off.
VStack(alignment: .leading, spacing: 3) {
HStack(alignment: .firstTextBaseline, spacing: 6) {
Text(station.name) Text(station.name)
.font(.headline) .font(.headline)
.lineLimit(1) .lineLimit(2)
.layoutPriority(1)
if isTopResult { if isTopResult {
Text("TOP") Text("TOP")
.font(.caption2.bold()) .font(.caption2.bold())
@@ -223,34 +226,39 @@ struct StationRow: View {
.background(Capsule().fill(.blue.opacity(0.15))) .background(Capsule().fill(.blue.opacity(0.15)))
.foregroundStyle(.blue) .foregroundStyle(.blue)
} }
} Spacer(minLength: 6)
Text("\(station.address), \(station.postcode)")
.font(.caption)
.foregroundStyle(.secondary)
.lineLimit(1)
if let location {
Text(String(format: "%.1f km away", station.distanceKM(to: location.lat, lng2: location.lng)))
.font(.caption2)
.foregroundStyle(.secondary)
}
}
Spacer()
if let price = station.prices[fuel] { if let price = station.prices[fuel] {
VStack(alignment: .trailing, spacing: 2) {
HStack(spacing: 5) { HStack(spacing: 5) {
Circle() Circle()
.fill(ragColor) .fill(ragColor)
.frame(width: 10, height: 10) .frame(width: 10, height: 10)
Text(String(format: "%.1fp", price)) Text(String(format: "%.1fp", price))
.font(.title3.bold()) .font(.title3.bold())
.monospacedDigit()
} }
}
}
HStack(spacing: 5) {
if let deltaText { if let deltaText {
Text(deltaText) Text(deltaText)
.font(.caption2.bold()) .font(.caption2.bold())
.foregroundStyle(ragColor) .foregroundStyle(ragColor)
} }
Text("\(station.address), \(station.postcode)")
.font(.caption)
.foregroundStyle(.secondary)
.lineLimit(1)
Spacer(minLength: 8)
if let location {
Text(String(format: "%.1f km", station.distanceKM(to: location.lat, lng2: location.lng)))
.font(.caption2)
.foregroundStyle(.secondary)
.monospacedDigit()
} }
} }
}
Button { Button {
onToggleFavourite() onToggleFavourite()
} label: { } label: {
+1 -1
View File
@@ -72,7 +72,7 @@ struct FavouritesView: View {
if let cheapest = cheapest { if let cheapest = cheapest {
Section { Section {
Text("\(cheapest.name) is your cheapest favourite for \(selectedFuel.displayName). Add the same stations to the Alerts tab to get pinged when you drive past a cheaper one.") Text("\(cheapest.name) is your cheapest favourite for \(selectedFuel.displayName). Favourites are monitored automatically — switch to the Alerts tab and enable alerts to get pinged when you approach one that's the cheapest within the radius.")
.font(.caption) .font(.caption)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
} }