refactor: TripDetailView loads games on demand, improve poll UI
- Refactor TripDetailView to fetch games from AppDataProvider when not provided, adding loading state indicator for better UX - Update all callers (25+ HomeContent variants, TripOptionsView, HomeView) to use simpler TripDetailView(trip:) initializer - Fix PollDetailView sheet issue by using sheet(item:) instead of sheet(isPresented:) to prevent blank screen on first tap - Improve PollDetailView UI with Theme styling, icons, and better visual hierarchy for share code, voting status, and results sections Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -166,7 +166,7 @@ struct HomeContent_Airbnb: View {
|
||||
ForEach(savedTrips.prefix(4)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
tripCard(trip)
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ struct HomeContent_AppleMaps: View {
|
||||
ForEach(Array(savedTrips.prefix(3).enumerated()), id: \.element.id) { index, savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
recentRow(trip, isLast: index == min(2, savedTrips.count - 1))
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ struct HomeContent_ArtDeco: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
HStack {
|
||||
decoDiamond
|
||||
|
||||
@@ -224,7 +224,7 @@ struct HomeContent_Brutalist: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
HStack {
|
||||
Text(trip.name.uppercased())
|
||||
|
||||
@@ -215,7 +215,7 @@ struct HomeContent_CarrotWeather: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
tripRow(trip)
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ struct HomeContent_Classic: View {
|
||||
ForEach(Array(savedTrips.prefix(3).enumerated()), id: \.element.id) { index, savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
classicTripCard(savedTrip: savedTrip, trip: trip)
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ struct HomeContent_DarkIndustrial: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
HStack {
|
||||
Rectangle()
|
||||
|
||||
@@ -183,7 +183,7 @@ struct HomeContent_Fantastical: View {
|
||||
ForEach(savedTrips.prefix(4)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
eventRow(trip)
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ struct HomeContent_Flighty: View {
|
||||
ForEach(savedTrips.prefix(2)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
tripCard(trip)
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ struct HomeContent_Glassmorphism: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
HStack(spacing: 16) {
|
||||
// Glow orb
|
||||
|
||||
@@ -283,7 +283,7 @@ struct HomeContent_LuxuryEditorial: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
HStack(alignment: .top, spacing: 16) {
|
||||
// Number
|
||||
|
||||
@@ -392,7 +392,7 @@ struct HomeContent_MaximalistChaos: View {
|
||||
ForEach(Array(savedTrips.prefix(3).enumerated()), id: \.element.id) { index, savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
let colors = [skyBlue, hotOrange, electricPurple]
|
||||
let accentColor = colors[index % colors.count]
|
||||
|
||||
@@ -290,7 +290,7 @@ struct HomeContent_NeoBrutalist: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
HStack {
|
||||
Rectangle()
|
||||
|
||||
@@ -169,7 +169,7 @@ struct HomeContent_NikeRunClub: View {
|
||||
ForEach(Array(savedTrips.prefix(3).enumerated()), id: \.element.id) { index, savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
activityRow(trip, index: index)
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ struct HomeContent_Organic: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
HStack(spacing: 14) {
|
||||
// Organic dot cluster
|
||||
|
||||
@@ -304,7 +304,7 @@ struct HomeContent_Playful: View {
|
||||
ForEach(Array(savedTrips.prefix(3).enumerated()), id: \.element.id) { index, savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
let colors = [candyYellow, candyGreen, candyBlue]
|
||||
let accentColor = colors[index % colors.count]
|
||||
|
||||
@@ -303,7 +303,7 @@ struct HomeContent_RetroFuturism: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
HStack {
|
||||
Text(trip.name)
|
||||
|
||||
@@ -162,7 +162,7 @@ struct HomeContent_SeatGeek: View {
|
||||
ForEach(savedTrips.prefix(4)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
yourTripCard(trip)
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ struct HomeContent_SoftPastel: View {
|
||||
ForEach(Array(savedTrips.prefix(3).enumerated()), id: \.element.id) { index, savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
let colors = [pastelPeach, pastelMint, pastelLavender]
|
||||
let accentColor = colors[index % colors.count]
|
||||
|
||||
@@ -101,7 +101,7 @@ struct HomeContent_Spotify: View {
|
||||
ForEach(savedTrips.prefix(5)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
tripCoverCard(trip)
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ struct HomeContent_Strava: View {
|
||||
ForEach(savedTrips.prefix(3)) { savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
activityCard(trip)
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ struct HomeContent_SwissModernist: View {
|
||||
ForEach(Array(savedTrips.prefix(3).enumerated()), id: \.element.id) { index, savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
VStack(spacing: 0) {
|
||||
HStack(spacing: 24) {
|
||||
|
||||
@@ -162,7 +162,7 @@ struct HomeContent_Things3: View {
|
||||
ForEach(Array(savedTrips.prefix(3).enumerated()), id: \.element.id) { index, savedTrip in
|
||||
if let trip = savedTrip.trip {
|
||||
NavigationLink {
|
||||
TripDetailView(trip: trip, games: savedTrip.games)
|
||||
TripDetailView(trip: trip)
|
||||
} label: {
|
||||
tripRow(trip)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user