Station name fills row width (logo left, price pinned right, wraps); fix Favourites alert wording
This commit is contained in:
+31
-23
@@ -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)")
|
if let price = station.prices[fuel] {
|
||||||
.font(.caption)
|
HStack(spacing: 5) {
|
||||||
.foregroundStyle(.secondary)
|
Circle()
|
||||||
.lineLimit(1)
|
.fill(ragColor)
|
||||||
if let location {
|
.frame(width: 10, height: 10)
|
||||||
Text(String(format: "%.1f km away", station.distanceKM(to: location.lat, lng2: location.lng)))
|
Text(String(format: "%.1fp", price))
|
||||||
.font(.caption2)
|
.font(.title3.bold())
|
||||||
.foregroundStyle(.secondary)
|
.monospacedDigit()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Spacer()
|
|
||||||
if let price = station.prices[fuel] {
|
|
||||||
VStack(alignment: .trailing, spacing: 2) {
|
|
||||||
HStack(spacing: 5) {
|
|
||||||
Circle()
|
|
||||||
.fill(ragColor)
|
|
||||||
.frame(width: 10, height: 10)
|
|
||||||
Text(String(format: "%.1fp", price))
|
|
||||||
.font(.title3.bold())
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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: {
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user