refactor: remove legacy trip creation flow, extract shared components
- Delete TripCreationView.swift and TripCreationViewModel.swift (unused) - Extract TripOptionsView to standalone file - Extract DateRangePicker and DayCell to standalone file - Extract LocationSearchSheet and CityInputType to standalone file - Fix TripWizardView to pass games dictionary to TripOptionsView - Remove debug print statements from TripDetailView Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ struct TripWizardView: View {
|
||||
@State private var viewModel = TripWizardViewModel()
|
||||
@State private var showTripOptions = false
|
||||
@State private var tripOptions: [ItineraryOption] = []
|
||||
@State private var gamesForDisplay: [String: RichGame] = [:]
|
||||
@State private var planningError: String?
|
||||
@State private var showError = false
|
||||
|
||||
@@ -91,7 +92,7 @@ struct TripWizardView: View {
|
||||
.navigationDestination(isPresented: $showTripOptions) {
|
||||
TripOptionsView(
|
||||
options: tripOptions,
|
||||
games: [:],
|
||||
games: gamesForDisplay,
|
||||
preferences: buildPreferences(),
|
||||
convertToTrip: { option in
|
||||
convertOptionToTrip(option)
|
||||
@@ -126,6 +127,17 @@ struct TripWizardView: View {
|
||||
let teamsById = Dictionary(uniqueKeysWithValues: AppDataProvider.shared.teams.map { ($0.id, $0) })
|
||||
let stadiumsById = Dictionary(uniqueKeysWithValues: AppDataProvider.shared.stadiums.map { ($0.id, $0) })
|
||||
|
||||
// Build RichGame dictionary for display
|
||||
var richGamesDict: [String: RichGame] = [:]
|
||||
for game in games {
|
||||
if let homeTeam = teamsById[game.homeTeamId],
|
||||
let awayTeam = teamsById[game.awayTeamId],
|
||||
let stadium = stadiumsById[game.stadiumId] {
|
||||
let richGame = RichGame(game: game, homeTeam: homeTeam, awayTeam: awayTeam, stadium: stadium)
|
||||
richGamesDict[game.id] = richGame
|
||||
}
|
||||
}
|
||||
|
||||
// Build planning request
|
||||
let request = PlanningRequest(
|
||||
preferences: preferences,
|
||||
@@ -144,6 +156,7 @@ struct TripWizardView: View {
|
||||
showError = true
|
||||
} else {
|
||||
tripOptions = options
|
||||
gamesForDisplay = richGamesDict
|
||||
showTripOptions = true
|
||||
}
|
||||
case .failure(let failure):
|
||||
|
||||
Reference in New Issue
Block a user