The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(native): no cut words on the watch, in any language or case size
Maurice3abc9eacf488
diff --git a/client/ios/App/TREKWatch/Details.swift b/client/ios/App/TREKWatch/Details.swiftindex 5e4f2ddb6..18ed82ea4 100644--- a/client/ios/App/TREKWatch/Details.swift+++ b/client/ios/App/TREKWatch/Details.swift@@ -23,7 +23,7 @@ struct DaysListView: View {Text(day.title ?? day.dateValue.map { WatchFormat.day($0) } ?? WatchFormat.dayOf(day.number, snapshot.days.count)).font(.system(.body, design: .rounded).weight(.semibold)).lineLimit(1)- Text(summary(day))+ Text(summary(day)).userText(summary(day)).font(.system(.caption2, design: .rounded)).foregroundStyle(WatchLook.muted).lineLimit(1)@@ -35,7 +35,7 @@ struct DaysListView: View {}}.navigationTitle(L("trip.days"))- .containerBackground(WatchLook.tripGradient(snapshot.trip?.title ?? "TREK"), for: .navigation)+ .containerBackground(WatchLook.tripGradient(snapshot.trip), for: .navigation)}private func summary(_ day: WatchSnapshot.Day) -> String {@@ -60,10 +60,6 @@ struct DayView: View {let day = snapshot.days.indices.contains(index) ? snapshot.days[index] : nillet isToday = day?.date == TrekDate.iso(now)let nowMinutes = isToday ? TrekDate.minutesOfDay(now) : (isPastDay(day) ? 24 * 60 : -1)- let stopsOfDay = day?.stops ?? []- // Today opens at the stop that is on or next, with the one before it for context.- let focus = isToday ? stopsOfDay.firstIndex { ($0.endMinutes ?? $0.minutes ?? -1) > nowMinutes } : nil- ScrollViewReader { proxy inScrollView {VStack(alignment: .leading, spacing: 0) {VStack(alignment: .leading, spacing: 1) {@@ -91,16 +87,11 @@ struct DayView: View {)}.buttonStyle(.plain)- .id(offset)}}}- .onAppear {- if let focus, focus > 1 { proxy.scrollTo(focus - 1, anchor: .top) }- }- }.navigationTitle(day?.dateValue.map { WatchFormat.weekday($0) } ?? L("trip.days"))- .containerBackground(WatchLook.tripGradient(snapshot.trip?.title ?? "TREK"), for: .navigation)+ .containerBackground(WatchLook.tripGradient(snapshot.trip), for: .navigation)}private func isPastDay(_ day: WatchSnapshot.Day?) -> Bool {@@ -144,13 +135,13 @@ struct TimelineRow: View {}}VStack(alignment: .leading, spacing: 1) {- Text(stop.name)+ Text(stop.name).userText(stop.name).font(.system(.footnote, design: .rounded).weight(state == .now ? .bold : .semibold)).foregroundStyle(state == .past ? WatchLook.muted : WatchLook.ink).lineLimit(2)// The street, whole: the first part of the address, on up to two lines.if let detail = stop.booking.map(WatchLook.kindName) ?? stop.address?.split(separator: ",").first.map(String.init) {- Text(detail)+ Text(detail).userText(detail).font(.system(.caption2, design: .rounded)).foregroundStyle(WatchLook.faint).lineLimit(2)@@ -185,7 +176,7 @@ struct StopDetailView: View {HStack(alignment: .top, spacing: 8) {StopGlyph(stop: item, size: 26)VStack(alignment: .leading, spacing: 1) {- Text(item.name)+ Text(item.name).userText(item.name).font(.system(.headline, design: .rounded)).lineLimit(3)if let start = item.minutes {@@ -197,12 +188,12 @@ struct StopDetailView: View {}}if let address = item.address {- Text(address)+ Text(address).userText(address).font(.footnote).foregroundStyle(WatchLook.muted)}if let note = item.note {- Text(note)+ Text(note).userText(note).font(.footnote).padding(8).frame(maxWidth: .infinity, alignment: .leading)@@ -287,7 +278,7 @@ struct BookingDetailView: View {FactTile(label: L("booking.checkOut"), value: [TrekDate.day(booking.endDate).map { WatchFormat.day($0) }, WatchFormat.time(minutes: checkOut, hour12: snapshot.hour12)].compactMap { $0 }.joined(separator: " "))}if let location = booking.location, booking.route == nil {- Text(location)+ Text(location).userText(location).font(.footnote).foregroundStyle(WatchLook.muted)}@@ -314,7 +305,7 @@ struct LegRow: View {HStack(alignment: .firstTextBaseline) {VStack(alignment: .leading, spacing: 1) {Text(label).watchEyebrow(WatchLook.faint)- Text(point.name)+ Text(point.name).userText(point.name).font(.system(.footnote, design: .rounded).weight(.semibold)).lineLimit(1)}@@ -353,7 +344,7 @@ struct BookingsListView: View {HStack(spacing: 8) {KindBadge(kind: booking.kind, size: 24)VStack(alignment: .leading, spacing: 1) {- Text(booking.route ?? booking.title)+ Text(booking.route ?? booking.title).userText((booking.route ?? booking.title)).font(.system(.footnote, design: .rounded).weight(.semibold)).lineLimit(1)Text(when(booking))@@ -367,7 +358,7 @@ struct BookingsListView: View {}}.navigationTitle(L("booking.all"))- .containerBackground(WatchLook.tripGradient(snapshot.trip?.title ?? "TREK"), for: .navigation)+ .containerBackground(WatchLook.tripGradient(snapshot.trip), for: .navigation)}private func when(_ booking: WatchSnapshot.Booking) -> String {@@ -435,6 +426,12 @@ 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 open.isEmpty {Label(allDone, systemImage: "checkmark.circle.fill").foregroundStyle(color)@@ -460,15 +457,6 @@ struct ChecklistView: View {}}.navigationTitle(title)- .toolbar {- if let summary {- ToolbarItem(placement: .topBarTrailing) {- Text(summary)- .font(.system(.footnote, design: .rounded).weight(.bold).monospacedDigit())- .foregroundStyle(color)- }- }- }.sensoryFeedback(.success, trigger: ticks).containerBackground(WatchLook.tint(color), for: .navigation)}@@ -495,7 +483,7 @@ struct ChecklistView: View {.foregroundStyle(item.done ? color : WatchLook.faint).contentTransition(.symbolEffect(.replace))VStack(alignment: .leading, spacing: 1) {- Text(item.name)+ Text(item.name).userText(item.name).font(.system(.body, design: .rounded).weight(.medium)).strikethrough(item.done, color: WatchLook.faint).foregroundStyle(item.done ? WatchLook.muted : WatchLook.ink)diff --git a/client/ios/App/TREKWatch/Pages.swift b/client/ios/App/TREKWatch/Pages.swiftindex 147adf2b0..738250125 100644--- a/client/ios/App/TREKWatch/Pages.swift+++ b/client/ios/App/TREKWatch/Pages.swift@@ -49,7 +49,7 @@ struct TodayPage: View {}}.contentMargins(.horizontal, 5, for: .scrollContent)- .containerBackground(WatchLook.tripGradient(snapshot.trip?.title ?? "TREK"), for: .tabView)+ .containerBackground(WatchLook.tripGradient(snapshot.trip), for: .tabView).toolbar {if let weather = snapshot.weather {ToolbarItem(placement: .topBarTrailing) { WeatherBadge(weather: weather) }@@ -69,7 +69,7 @@ struct TodayPage: View {.font(.system(size: 9, weight: .heavy)).foregroundStyle(WatchLook.muted)}- Text(snapshot.trip?.title ?? "")+ Text(snapshot.trip?.title ?? "").userText((snapshot.trip?.title ?? "")).font(.system(.footnote, design: .rounded).weight(.semibold)).foregroundStyle(WatchLook.muted).lineLimit(1)@@ -101,7 +101,7 @@ struct FocusCard: View {.watchEyebrow(isNow ? Trek.confirmed : WatchLook.muted)Spacer(minLength: 0)}- Text(stop.name)+ Text(stop.name).userText(stop.name).font(.system(WatchScreen.compact ? .headline : .title3, design: .rounded).weight(.bold)).foregroundStyle(WatchLook.ink).lineLimit(2)@@ -132,7 +132,7 @@ struct FocusCard: View {Text(WatchFormat.time(minutes: minutes, hour12: hour12)).monospacedDigit().foregroundStyle(WatchLook.muted)}- Text(then.name)+ Text(then.name).userText(then.name).foregroundStyle(WatchLook.ink.opacity(0.85)).lineLimit(1)}@@ -189,7 +189,7 @@ struct CompactStopRow: View {var body: some View {HStack(spacing: 8) {StopGlyph(stop: stop, size: 20)- Text(stop.name)+ Text(stop.name).userText(stop.name).font(.system(.footnote, design: .rounded).weight(.semibold)).foregroundStyle(WatchLook.ink).lineLimit(1)@@ -217,7 +217,7 @@ struct DoneCard: View {.symbolRenderingMode(.multicolor).foregroundStyle(Trek.confirmed)Text(title).font(.system(.headline, design: .rounded)).foregroundStyle(WatchLook.ink)- Text(detail).font(.footnote).foregroundStyle(WatchLook.muted)+ Text(detail).userText(detail).font(.footnote).foregroundStyle(WatchLook.muted)}.padding(10).frame(maxWidth: .infinity, alignment: .leading)@@ -251,6 +251,8 @@ struct CountdownPage: View {let trip = snapshot.tripVStack(alignment: .leading, spacing: 2) {Text(L("countdown.title")).watchEyebrow(.white.opacity(0.85))+ .lineLimit(2)+ .fixedSize(horizontal: false, vertical: true)Spacer(minLength: 0)HStack(alignment: .firstTextBaseline, spacing: 4) {Text("\(days)")@@ -263,7 +265,7 @@ struct CountdownPage: View {.minimumScaleFactor(0.6)}.foregroundStyle(.white)- Text(trip?.title ?? "")+ Text(trip?.title ?? "").userText((trip?.title ?? "")).font(.system(.headline, design: .rounded)).foregroundStyle(.white).lineLimit(2)@@ -289,7 +291,16 @@ struct CountdownPage: View {.accessibilityElement(children: .combine).padding(.horizontal, 5).containerBackground(for: .tabView) {- TripBackdrop(trip: widgetTrip(trip), shade: 0.7)+ if trip?.cover != nil {+ TripBackdrop(trip: widgetTrip(trip), shade: 0.7)+ } else {+ let (first, second) = WatchLook.tripColors(trip)+ ZStack {+ LinearGradient(colors: [first, second, .black], startPoint: .topLeading, endPoint: .bottom)+ ContourLines(seed: UInt64(trip?.id ?? 1) % 997, rings: 11)+ .stroke(Color.white.opacity(0.12), lineWidth: 0.9)+ }+ }}.toolbar {if let weather = snapshot.weather {@@ -358,7 +369,7 @@ struct BookingSummary: View {.foregroundStyle(WatchLook.muted).lineLimit(1)} else {- Text(booking.title)+ Text(booking.title).userText(booking.title).font(.system(.title3, design: .rounded).weight(.bold)).lineLimit(2).minimumScaleFactor(0.75)@@ -378,14 +389,18 @@ struct BookingSummary: View {let clock = running ? booking.checkOut ?? booking.endTime : booking.timeif let moment {// The day goes first when the line is too short for all three.+ let label = running ? L("booking.checkOut") : dayLabel(moment)ViewThatFits(in: .horizontal) {- timeLine(clock: clock, label: running ? L("booking.checkOut") : dayLabel(moment), moment: moment)- timeLine(clock: clock, label: nil, moment: moment)+ timeLine(clock: clock, label: label, moment: moment, pill: true)+ VStack(alignment: .leading, spacing: 4) {+ timeLine(clock: clock, label: label, moment: moment, pill: false)+ countdownPill(moment)+ }}}}- private func timeLine(clock: String?, label: String?, moment: Date) -> some View {+ private func timeLine(clock: String?, label: String?, moment: Date, pill: Bool) -> some View {HStack(alignment: .firstTextBaseline, spacing: 5) {if let clock, let minutes = TrekDate.minutes(clock) {Text(WatchFormat.time(minutes: minutes, hour12: hour12))@@ -398,20 +413,26 @@ struct BookingSummary: View {.foregroundStyle(WatchLook.muted).fixedSize()}- Spacer(minLength: 2)- if moment > now {- Text(WatchFormat.relative(moment, now: now))- .font(.system(.caption2, design: .rounded).weight(.bold))- .foregroundStyle(.white)- .lineLimit(1)- .minimumScaleFactor(0.8)- .padding(.horizontal, 7)- .padding(.vertical, 3)- .background(Capsule().fill(Trek.booking(booking.kind).color.opacity(0.85)))+ if pill {+ Spacer(minLength: 4)+ countdownPill(moment)}}}+ @ViewBuilder+ private func countdownPill(_ moment: Date) -> some View {+ if moment > now {+ Text(WatchFormat.relative(moment, now: now))+ .font(.system(.caption2, design: .rounded).weight(.bold))+ .foregroundStyle(.white)+ .fixedSize()+ .padding(.horizontal, 7)+ .padding(.vertical, 3)+ .background(Capsule().fill(Trek.booking(booking.kind).color.opacity(0.85)))+ }+ }+private var factTiles: [(label: String, value: String)] {var tiles: [(label: String, value: String)] = []if let seat = booking.seat { tiles.append((L("booking.seat"), seat)) }@@ -434,11 +455,13 @@ struct BookingSummary: View {private var facts: some View {let tiles = factTilesif compactFacts {- HStack(spacing: 6) {- if let code = booking.code { FactTile(label: L("booking.ref"), value: code, mono: true) }- if let first = tiles.first {- FactTile(label: first.label, value: first.value)- .frame(maxWidth: booking.code == nil ? .infinity : 64)+ let row = [booking.code.map { (L("booking.ref"), $0, true) }, tiles.first.map { ($0.label, $0.value, false) }].compactMap { $0 }+ ViewThatFits(in: .horizontal) {+ HStack(spacing: 6) {+ ForEach(row, id: \.0) { FactTile(label: $0.0, value: $0.1, mono: $0.2, fits: true) }+ }+ VStack(spacing: 6) {+ ForEach(row, id: \.0) { FactTile(label: $0.0, value: $0.1, mono: $0.2) }}}} else {@@ -493,7 +516,7 @@ struct TripPage: View {.frame(width: 46, height: 46).accessibilityLabel(index > 0 ? WatchFormat.dayOf(index, total) : "\(total) \(WatchFormat.daysUnit(total))")VStack(alignment: .leading, spacing: 1) {- Text(trip?.title ?? "")+ Text(trip?.title ?? "").userText((trip?.title ?? "")).font(.system(.headline, design: .rounded)).lineLimit(2).minimumScaleFactor(0.8)@@ -528,7 +551,7 @@ struct TripPage: View {.foregroundStyle(WatchLook.ink)}.contentMargins(.horizontal, 5, for: .scrollContent)- .containerBackground(WatchLook.tripGradient(trip?.title ?? "TREK"), for: .tabView)+ .containerBackground(WatchLook.tripGradient(trip), for: .tabView)}}@@ -549,8 +572,8 @@ struct MenuRow: View {.background(Circle().fill(color.gradient))Text(title).font(.system(.body, design: .rounded).weight(.semibold))- .lineLimit(1)- .minimumScaleFactor(0.7)+ .lineLimit(2)+ .fixedSize(horizontal: false, vertical: true)Spacer(minLength: 4)if let value {Text(value)@@ -593,7 +616,7 @@ struct ListsPage: View {if let next = snapshot.packing?.items.first(where: { !$0.done }) {HStack(spacing: 6) {Image(systemName: "circle").foregroundStyle(WatchLook.packing)- Text(next.name).lineLimit(1)+ Text(next.name).userText(next.name).lineLimit(1)Spacer(minLength: 0)}.font(.system(.footnote, design: .rounded).weight(.medium))@@ -625,7 +648,7 @@ struct ListRing: View {if let of {Text(of).font(.system(size: 10, weight: .bold, design: .rounded)).foregroundStyle(WatchLook.muted)} else {- Text(detail).font(.system(size: 9, weight: .bold, design: .rounded)).foregroundStyle(WatchLook.muted).lineLimit(1).minimumScaleFactor(0.6)+ Text(detail).userText(detail).font(.system(size: 9, weight: .bold, design: .rounded)).foregroundStyle(WatchLook.muted).lineLimit(1).minimumScaleFactor(0.6)}}.padding(6)diff --git a/client/ios/App/TREKWatchKit/WatchStyle.swift b/client/ios/App/TREKWatchKit/WatchStyle.swiftindex 49ed96f0e..2066420e4 100644--- a/client/ios/App/TREKWatchKit/WatchStyle.swift+++ b/client/ios/App/TREKWatchKit/WatchStyle.swift@@ -105,10 +105,28 @@ enum WatchLook {static let packing = Color(hex: 0x2FA37A)static let todo = Color(hex: 0x4A7DDB)+ /// The lights a trip's pages can have: clear, saturated hues that stay+ /// clean when they fade into black (no ochre or olive, which turn muddy).+ static let palette: [(Color, Color)] = [+ (Color(hex: 0x3D6FD8), Color(hex: 0x1C2E73)),+ (Color(hex: 0x2BA59A), Color(hex: 0x0E4E5A)),+ (Color(hex: 0x7A5AE0), Color(hex: 0x2E1F6B)),+ (Color(hex: 0xD2557A), Color(hex: 0x5C1A3A)),+ (Color(hex: 0x2E8BC0), Color(hex: 0x113A5C)),+ (Color(hex: 0xE0703C), Color(hex: 0x5E2414)),+ (Color(hex: 0x3FA866), Color(hex: 0x134A2C)),+ ]++ /// A trip's own two colours, picked by its id, so they do not change with+ /// its title or the language it is shown in.+ static func tripColors(_ trip: WatchSnapshot.Trip?) -> (Color, Color) {+ palette[(trip?.id ?? 1) % palette.count]+ }+/// A trip's page light: its first colour at the top, fading into black.- static func tripGradient(_ title: String) -> LinearGradient {- let (first, second) = Trek.tripHues(title)- return LinearGradient(colors: [first.opacity(0.85), second.opacity(0.55), .black], startPoint: .top, endPoint: .bottom)+ static func tripGradient(_ trip: WatchSnapshot.Trip?) -> LinearGradient {+ let (first, second) = tripColors(trip)+ return LinearGradient(colors: [first.opacity(0.85), second.opacity(0.6), .black], startPoint: .top, endPoint: .bottom)}static func tint(_ color: Color) -> LinearGradient {@@ -144,6 +162,14 @@ struct WatchEyebrow: ViewModifier {}extension View {+ /// Text a person wrote (a place, a booking, an item): when it is in Latin+ /// letters it is set as such, so in a Chinese, Japanese or Korean interface+ /// it still breaks between words rather than inside one.+ func userText(_ text: String?) -> some View {+ let latin = (text ?? "").unicodeScalars.allSatisfy { $0.value < 0x0250 || $0.properties.isWhitespace || $0.properties.generalCategory == .dashPunctuation || $0.properties.generalCategory == .otherPunctuation }+ return typesettingLanguage(Locale.Language(identifier: "en"), isEnabled: latin)+ }+func watchEyebrow(_ color: Color = WatchLook.muted) -> some View { modifier(WatchEyebrow(color: color)) }/// A card of glass on watchOS 26, of frosted white before.@@ -210,10 +236,13 @@ struct FactTile: View {let label: Stringlet value: Stringvar mono = false+ /// Laid out at its natural width, so a ViewThatFits can tell when a row of them is too wide.+ var fits = falsevar body: some View {VStack(alignment: .leading, spacing: 1) {Text(label).watchEyebrow(WatchLook.faint)+ .fixedSize(horizontal: fits, vertical: false)Text(value).font(mono ? .system(.body, design: .monospaced).weight(.semibold) : .system(.body, design: .rounded).weight(.semibold)).foregroundStyle(WatchLook.ink)diff --git a/client/ios/scripts/watch-screens.sh b/client/ios/scripts/watch-screens.shindex 346241a3c..48c17a880 100644--- a/client/ios/scripts/watch-screens.sh+++ b/client/ios/scripts/watch-screens.sh@@ -114,10 +114,23 @@ faces faces running -MAIN="today booking countdown trip lists packing day"LANGS="ar az ca cs de el en es et fr he hu id it ja ko nl pl pt-BR ru sk sv th tr uk vi zh-Hans zh-Hant"+# The watch draws its corner clock in its own region's format, not the app's:+# English goes first on a 12 hour clock, then the watch is switched to 24+# hours, as the other languages read it, and restarted for the clock to follow.+use_24_hours() {+ local udid=$1+ xcrun simctl spawn "$udid" defaults write -g AppleICUForce24HourTime -bool YES+ xcrun simctl spawn "$udid" defaults write -g AppleLocale de_DE+ xcrun simctl shutdown "$udid"+ xcrun simctl boot "$udid"+ xcrun simctl bootstatus "$udid" -b >/dev/null+}+EXPECTED=()run() {local size=$1 udid=$2 lang shotname screen scenario clockfor lang in en de ru; do+ [ "$lang" = de ] && use_24_hours "$udid"while read -r shotname screen scenario clock; do[ -n "$shotname" ] || continueEXPECTED+=("$size-$lang-$shotname.png")