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:
Trey t
2026-01-14 11:31:05 -06:00
parent b5aea31b1a
commit 2ad458bffd
28 changed files with 314 additions and 135 deletions

View File

@@ -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)
}

View File

@@ -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))
}

View File

@@ -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

View File

@@ -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())

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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()

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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()

View File

@@ -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)
}

View File

@@ -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

View File

@@ -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]

View File

@@ -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)

View File

@@ -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)
}

View File

@@ -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]

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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) {

View File

@@ -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)
}