UI overhaul: new color palette, trip creation improvements, crash fix
Theme: - New teal/cyan/mint/pink/gold color palette replacing orange/cream - Added Theme.swift, ViewModifiers.swift, AnimatedComponents.swift Trip Creation: - Removed Drive/Fly toggle (drive-only for now) - Removed Lodging Type picker - Renamed "Number of Stops" to "Number of Cities" with explanation - Added explanation for "Find Other Sports Along Route" - Removed staggered animation from trip options list Bug Fix: - Disabled AI route description generation (Foundation Models crashes in iOS 26.2 Simulator due to NLLanguageRecognizer assertion failure) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,7 +72,7 @@ extension Game: Equatable {
|
||||
|
||||
// MARK: - Rich Game Model (with resolved references)
|
||||
|
||||
struct RichGame: Identifiable, Hashable {
|
||||
struct RichGame: Identifiable, Hashable, Codable {
|
||||
let game: Game
|
||||
let homeTeam: Team
|
||||
let awayTeam: Team
|
||||
|
||||
@@ -45,13 +45,14 @@ enum Sport: String, Codable, CaseIterable, Identifiable {
|
||||
}
|
||||
}
|
||||
|
||||
var seasonMonths: ClosedRange<Int> {
|
||||
/// Season start and end months (1-12). End may be less than start for seasons that wrap around the year.
|
||||
var seasonMonths: (start: Int, end: Int) {
|
||||
switch self {
|
||||
case .mlb: return 3...10 // March - October
|
||||
case .nba: return 10...6 // October - June (wraps)
|
||||
case .nhl: return 10...6 // October - June (wraps)
|
||||
case .nfl: return 9...2 // September - February (wraps)
|
||||
case .mls: return 2...12 // February - December
|
||||
case .mlb: return (3, 10) // March - October
|
||||
case .nba: return (10, 6) // October - June (wraps)
|
||||
case .nhl: return (10, 6) // October - June (wraps)
|
||||
case .nfl: return (9, 2) // September - February (wraps)
|
||||
case .mls: return (2, 12) // February - December
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +60,13 @@ enum Sport: String, Codable, CaseIterable, Identifiable {
|
||||
let calendar = Calendar.current
|
||||
let month = calendar.component(.month, from: date)
|
||||
|
||||
let range = seasonMonths
|
||||
if range.lowerBound <= range.upperBound {
|
||||
return range.contains(month)
|
||||
let (start, end) = seasonMonths
|
||||
if start <= end {
|
||||
// Normal range (e.g., March to October)
|
||||
return month >= start && month <= end
|
||||
} else {
|
||||
// Season wraps around year boundary
|
||||
return month >= range.lowerBound || month <= range.upperBound
|
||||
// Season wraps around year boundary (e.g., October to June)
|
||||
return month >= start || month <= end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ final class SavedTrip {
|
||||
var updatedAt: Date
|
||||
var status: String
|
||||
var tripData: Data // Encoded Trip struct
|
||||
var gamesData: Data? // Encoded [UUID: RichGame] dictionary
|
||||
|
||||
@Relationship(deleteRule: .cascade)
|
||||
var votes: [TripVote]?
|
||||
@@ -26,7 +27,8 @@ final class SavedTrip {
|
||||
createdAt: Date = Date(),
|
||||
updatedAt: Date = Date(),
|
||||
status: TripStatus = .planned,
|
||||
tripData: Data
|
||||
tripData: Data,
|
||||
gamesData: Data? = nil
|
||||
) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
@@ -34,25 +36,33 @@ final class SavedTrip {
|
||||
self.updatedAt = updatedAt
|
||||
self.status = status.rawValue
|
||||
self.tripData = tripData
|
||||
self.gamesData = gamesData
|
||||
}
|
||||
|
||||
var trip: Trip? {
|
||||
try? JSONDecoder().decode(Trip.self, from: tripData)
|
||||
}
|
||||
|
||||
var games: [UUID: RichGame] {
|
||||
guard let data = gamesData else { return [:] }
|
||||
return (try? JSONDecoder().decode([UUID: RichGame].self, from: data)) ?? [:]
|
||||
}
|
||||
|
||||
var tripStatus: TripStatus {
|
||||
TripStatus(rawValue: status) ?? .draft
|
||||
}
|
||||
|
||||
static func from(_ trip: Trip, status: TripStatus = .planned) -> SavedTrip? {
|
||||
guard let data = try? JSONEncoder().encode(trip) else { return nil }
|
||||
static func from(_ trip: Trip, games: [UUID: RichGame] = [:], status: TripStatus = .planned) -> SavedTrip? {
|
||||
guard let tripData = try? JSONEncoder().encode(trip) else { return nil }
|
||||
let gamesData = try? JSONEncoder().encode(games)
|
||||
return SavedTrip(
|
||||
id: trip.id,
|
||||
name: trip.name,
|
||||
createdAt: trip.createdAt,
|
||||
updatedAt: trip.updatedAt,
|
||||
status: status,
|
||||
tripData: data
|
||||
tripData: tripData,
|
||||
gamesData: gamesData
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user