mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 03:50:30 +00:00
fix(native): compact list progress, one-line menu rows, a booking header that wraps instead of cutting
The packing list and to-dos open with a slim progress bar and their count, the list right under it. The trip's menu rows stay on one line and shrink a little before anything wraps. A booking's kind and status share a line when they fit and stack when they do not; its countdown drops the day word before it moves under the time. The place map fades its top edge, where labels were cut, and leaves Apple's attribution as MapKit draws it. The complication gallery has no English section names.
This commit is contained in:
@@ -221,7 +221,7 @@ struct MiniMap: View {
|
||||
let coordinate = CLLocationCoordinate2D(latitude: lat, longitude: lng)
|
||||
// From above, without street names or points of interest, so the stop's
|
||||
// own pin is what stands out; Apple's attribution stays in its corner.
|
||||
Map(initialPosition: .region(MKCoordinateRegion(center: coordinate, latitudinalMeters: 700, longitudinalMeters: 700)), interactionModes: []) {
|
||||
Map(initialPosition: .region(MKCoordinateRegion(center: coordinate, latitudinalMeters: 1100, longitudinalMeters: 1100)), interactionModes: []) {
|
||||
Annotation(name, coordinate: coordinate, anchor: .center) {
|
||||
Circle()
|
||||
.fill(color.gradient)
|
||||
@@ -231,8 +231,15 @@ struct MiniMap: View {
|
||||
}
|
||||
.annotationTitles(.hidden)
|
||||
}
|
||||
.mapStyle(.imagery(elevation: .flat))
|
||||
.frame(height: 104)
|
||||
.mapStyle(.standard(elevation: .flat, emphasis: .muted, pointsOfInterest: .excludingAll, showsTraffic: false))
|
||||
.frame(height: 118)
|
||||
// A soft fade over the top edge only, where labels would be cut; the
|
||||
// attribution sits at the bottom and stays as MapKit draws it.
|
||||
.overlay(alignment: .top) {
|
||||
LinearGradient(colors: [.black.opacity(0.55), .clear], startPoint: .top, endPoint: .bottom)
|
||||
.frame(height: 26)
|
||||
.allowsHitTesting(false)
|
||||
}
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14, style: .continuous))
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
@@ -384,7 +391,7 @@ struct PackingListView: View {
|
||||
color: WatchLook.packing,
|
||||
open: items.filter { !$0.done },
|
||||
done: items.filter(\.done),
|
||||
summary: packing.map { "\($0.packed)/\($0.total)" },
|
||||
progress: packing.map { ($0.packed, $0.total) },
|
||||
doneTitle: L("packing.packedSection"),
|
||||
allDone: L("packing.allPacked"),
|
||||
grouped: true
|
||||
@@ -403,7 +410,7 @@ struct TodoListView: View {
|
||||
color: WatchLook.todo,
|
||||
open: items.filter { !$0.done },
|
||||
done: items.filter(\.done),
|
||||
summary: todos.map { "\($0.total - $0.open)/\($0.total)" },
|
||||
progress: todos.map { ($0.total - $0.open, $0.total) },
|
||||
doneTitle: L("todos.doneSection"),
|
||||
allDone: L("todos.allDone"),
|
||||
grouped: false
|
||||
@@ -417,7 +424,7 @@ struct ChecklistView: View {
|
||||
let color: Color
|
||||
let open: [WatchSnapshot.Item]
|
||||
let done: [WatchSnapshot.Item]
|
||||
let summary: String?
|
||||
let progress: (done: Int, total: Int)?
|
||||
let doneTitle: String
|
||||
let allDone: String
|
||||
let grouped: Bool
|
||||
@@ -426,11 +433,18 @@ struct ChecklistView: View {
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
if let summary {
|
||||
Text(summary)
|
||||
.font(.system(.title3, design: .rounded).weight(.heavy).monospacedDigit())
|
||||
.foregroundStyle(color)
|
||||
.listRowBackground(Color.clear)
|
||||
if let progress {
|
||||
HStack(spacing: 8) {
|
||||
ProgressView(value: Double(progress.done), total: Double(max(progress.total, 1)))
|
||||
.tint(color)
|
||||
Text("\(progress.done)/\(progress.total)")
|
||||
.font(.system(.footnote, design: .rounded).weight(.bold).monospacedDigit())
|
||||
.foregroundStyle(color)
|
||||
.fixedSize()
|
||||
}
|
||||
.listRowBackground(Color.clear)
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 6, bottom: 0, trailing: 6))
|
||||
.accessibilityElement(children: .combine)
|
||||
}
|
||||
if open.isEmpty {
|
||||
Label(allDone, systemImage: "checkmark.circle.fill")
|
||||
|
||||
@@ -14,23 +14,22 @@ struct FacesView: View {
|
||||
let state = ComplicationState(snapshot, now: now)
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
caption("circular")
|
||||
HStack(spacing: 8) {
|
||||
round { NextStopComplication(state: state, family: .circular, now: now) }
|
||||
round { CountdownComplication(state: state, family: .circular, now: now) }
|
||||
round { TripDayComplication(state: state, family: .circular) }
|
||||
}
|
||||
caption("corner")
|
||||
Divider().opacity(0.3)
|
||||
HStack(spacing: 8) {
|
||||
round { NextStopComplication(state: state, family: .corner, now: now) }
|
||||
round { CountdownComplication(state: state, family: .corner, now: now) }
|
||||
round { TripDayComplication(state: state, family: .corner) }
|
||||
}
|
||||
caption("rectangular")
|
||||
Divider().opacity(0.3)
|
||||
wide(56) { NextStopComplication(state: state, family: .rectangular, now: now) }
|
||||
wide(56) { CountdownComplication(state: state, family: .rectangular, now: now) }
|
||||
wide(56) { TripDayComplication(state: state, family: .rectangular) }
|
||||
caption("inline")
|
||||
Divider().opacity(0.3)
|
||||
wide(18) { NextStopComplication(state: state, family: .inline, now: now) }
|
||||
wide(18) { CountdownComplication(state: state, family: .inline, now: now) }
|
||||
wide(18) { TripDayComplication(state: state, family: .inline) }
|
||||
@@ -44,10 +43,6 @@ struct FacesView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func caption(_ text: String) -> some View {
|
||||
Text(text).watchEyebrow(WatchLook.faint)
|
||||
}
|
||||
|
||||
private func round<Content: View>(@ViewBuilder _ content: () -> Content) -> some View {
|
||||
content()
|
||||
.frame(width: dial, height: dial)
|
||||
|
||||
@@ -346,17 +346,22 @@ struct BookingSummary: View {
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: WatchScreen.compact ? 4 : 6) {
|
||||
// The kind and the status in one line: "FLIGHT · Confirmed".
|
||||
HStack(spacing: 5) {
|
||||
KindBadge(kind: booking.kind, size: 20)
|
||||
Text(WatchLook.kindName(booking.kind)).watchEyebrow(.white.opacity(0.85))
|
||||
Circle().fill(booking.confirmed ? Trek.confirmed : Trek.pending).frame(width: 5, height: 5)
|
||||
Text(L(booking.confirmed ? "booking.confirmed" : "booking.pending"))
|
||||
.font(.system(.caption2, design: .rounded).weight(.medium))
|
||||
.foregroundStyle(WatchLook.muted)
|
||||
.lineLimit(1)
|
||||
.minimumScaleFactor(0.7)
|
||||
Spacer(minLength: 0)
|
||||
// The kind and the status in one line ("FLIGHT · Confirmed"), the status under it when that is too long.
|
||||
ViewThatFits(in: .horizontal) {
|
||||
HStack(spacing: 5) {
|
||||
KindBadge(kind: booking.kind, size: 20)
|
||||
kindLabel.fixedSize()
|
||||
status.fixedSize()
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
HStack(spacing: 6) {
|
||||
KindBadge(kind: booking.kind, size: 22)
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
kindLabel
|
||||
status
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: .combine)
|
||||
if let route = booking.route {
|
||||
@@ -365,7 +370,7 @@ struct BookingSummary: View {
|
||||
.lineLimit(1)
|
||||
.minimumScaleFactor(0.55)
|
||||
Text(booking.carrier ?? booking.title)
|
||||
.font(.system(.footnote, design: .rounded).weight(.medium))
|
||||
.font(.system(WatchScreen.compact ? .caption : .footnote, design: .rounded).weight(.medium))
|
||||
.foregroundStyle(WatchLook.muted)
|
||||
.lineLimit(1)
|
||||
} else {
|
||||
@@ -392,6 +397,7 @@ struct BookingSummary: View {
|
||||
let label = running ? L("booking.checkOut") : dayLabel(moment)
|
||||
ViewThatFits(in: .horizontal) {
|
||||
timeLine(clock: clock, label: label, moment: moment, pill: true)
|
||||
timeLine(clock: clock, label: nil, moment: moment, pill: true)
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
timeLine(clock: clock, label: label, moment: moment, pill: false)
|
||||
countdownPill(moment)
|
||||
@@ -433,6 +439,25 @@ struct BookingSummary: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var kindLabel: some View {
|
||||
Text(WatchLook.kindName(booking.kind))
|
||||
.font(.system(.caption2, design: .rounded).weight(.bold))
|
||||
.textCase(.uppercase)
|
||||
.tracking(0.4)
|
||||
.foregroundStyle(.white.opacity(0.85))
|
||||
.lineLimit(1)
|
||||
}
|
||||
|
||||
private var status: some View {
|
||||
HStack(spacing: 4) {
|
||||
Circle().fill(booking.confirmed ? Trek.confirmed : Trek.pending).frame(width: 5, height: 5)
|
||||
Text(L(booking.confirmed ? "booking.confirmed" : "booking.pending"))
|
||||
.font(.system(.caption2, design: .rounded).weight(.medium))
|
||||
.foregroundStyle(WatchLook.muted)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
|
||||
private var factTiles: [(label: String, value: String)] {
|
||||
var tiles: [(label: String, value: String)] = []
|
||||
if let seat = booking.seat { tiles.append((L("booking.seat"), seat)) }
|
||||
@@ -564,24 +589,26 @@ struct MenuRow: View {
|
||||
let value: String?
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 8) {
|
||||
let compact = WatchScreen.compact
|
||||
HStack(spacing: compact ? 6 : 8) {
|
||||
Image(systemName: symbol)
|
||||
.font(.system(size: 13, weight: .semibold))
|
||||
.font(.system(size: compact ? 11 : 13, weight: .semibold))
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: 26, height: 26)
|
||||
.frame(width: compact ? 22 : 26, height: compact ? 22 : 26)
|
||||
.background(Circle().fill(color.gradient))
|
||||
Text(title)
|
||||
.font(.system(.body, design: .rounded).weight(.semibold))
|
||||
.lineLimit(2)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
Spacer(minLength: 4)
|
||||
.font(.system(compact ? .callout : .body, design: .rounded).weight(.semibold))
|
||||
.lineLimit(1)
|
||||
.minimumScaleFactor(0.78)
|
||||
.allowsTightening(true)
|
||||
Spacer(minLength: 2)
|
||||
if let value {
|
||||
Text(value)
|
||||
.font(.system(.footnote, design: .rounded).weight(.semibold).monospacedDigit())
|
||||
.foregroundStyle(WatchLook.muted)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.horizontal, WatchScreen.compact ? 8 : 10)
|
||||
.padding(.vertical, 8)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.watchCard(cornerRadius: 16)
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"place.title" = "Tempat";
|
||||
"place.directions" = "Petunjuk arah";
|
||||
"lists.title" = "Daftar";
|
||||
"packing.title" = "Barang bawaan";
|
||||
"packing.title" = "Bawaan";
|
||||
"packing.packed" = "dikemas";
|
||||
"packing.packedSection" = "Sudah dikemas";
|
||||
"packing.allPacked" = "Semua sudah dikemas";
|
||||
|
||||
Reference in New Issue
Block a user