Pass selected sport from quick start to trip creation
- Add initialSport parameter to TripCreationView - Set selected sport when quick start button is tapped - Auto-select that sport in trip planning view on appear - Clear selection when sheet is dismissed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ struct HomeView: View {
|
||||
@Query(sort: \SavedTrip.updatedAt, order: .reverse) private var savedTrips: [SavedTrip]
|
||||
|
||||
@State private var showNewTrip = false
|
||||
@State private var selectedSport: Sport?
|
||||
@State private var selectedTab = 0
|
||||
|
||||
var body: some View {
|
||||
@@ -88,7 +89,12 @@ struct HomeView: View {
|
||||
}
|
||||
.tint(Theme.warmOrange)
|
||||
.sheet(isPresented: $showNewTrip) {
|
||||
TripCreationView()
|
||||
TripCreationView(initialSport: selectedSport)
|
||||
}
|
||||
.onChange(of: showNewTrip) { _, isShowing in
|
||||
if !isShowing {
|
||||
selectedSport = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +152,7 @@ struct HomeView: View {
|
||||
HStack(spacing: Theme.Spacing.sm) {
|
||||
ForEach(Sport.supported) { sport in
|
||||
QuickSportButton(sport: sport) {
|
||||
selectedSport = sport
|
||||
showNewTrip = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user