fix: multiple bug fixes and improvements
- Fix suggested trips showing wrong sports for cross-country trips - Remove quick start sections from home variants (Classic, Spotify) - Remove dead quickActions code from HomeView - Fix pace capsule animation in TripCreationView - Add text wrapping to achievement descriptions - Improve poll parsing with better error handling - Various sharing system improvements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,15 +18,25 @@ struct PollDetailView: View {
|
||||
|
||||
let pollId: UUID?
|
||||
let shareCode: String?
|
||||
let initialPoll: TripPoll?
|
||||
|
||||
init(pollId: UUID) {
|
||||
self.pollId = pollId
|
||||
self.shareCode = nil
|
||||
self.initialPoll = nil
|
||||
}
|
||||
|
||||
init(shareCode: String) {
|
||||
self.pollId = nil
|
||||
self.shareCode = shareCode
|
||||
self.initialPoll = nil
|
||||
}
|
||||
|
||||
/// Initialize with a poll object directly (avoids fetch delay)
|
||||
init(poll: TripPoll) {
|
||||
self.pollId = poll.id
|
||||
self.shareCode = nil
|
||||
self.initialPoll = poll
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
@@ -217,7 +227,10 @@ struct PollDetailView: View {
|
||||
}
|
||||
|
||||
private func loadPoll() async {
|
||||
if let pollId {
|
||||
// If we have an initial poll object, use it directly to avoid CloudKit fetch delay
|
||||
if let initialPoll {
|
||||
await viewModel.loadPoll(from: initialPoll)
|
||||
} else if let pollId {
|
||||
await viewModel.loadPoll(byId: pollId)
|
||||
} else if let shareCode {
|
||||
await viewModel.loadPoll(byShareCode: shareCode)
|
||||
@@ -291,6 +304,15 @@ private struct TripPreviewCard: View {
|
||||
.font(.headline)
|
||||
}
|
||||
|
||||
// Date range and duration
|
||||
HStack {
|
||||
Label(trip.formattedDateRange, systemImage: "calendar")
|
||||
Spacer()
|
||||
Label("\(trip.tripDuration) days", systemImage: "clock")
|
||||
}
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
|
||||
HStack {
|
||||
Label("\(trip.stops.count) stops", systemImage: "mappin.and.ellipse")
|
||||
Spacer()
|
||||
@@ -303,7 +325,7 @@ private struct TripPreviewCard: View {
|
||||
Text(trip.stops.map { $0.city }.joined(separator: " → "))
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
.lineLimit(2)
|
||||
}
|
||||
.padding()
|
||||
.background(Theme.cardBackground(colorScheme))
|
||||
|
||||
@@ -11,6 +11,7 @@ struct PollsListView: View {
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
@State private var polls: [TripPoll] = []
|
||||
@State private var isLoading = false
|
||||
@State private var hasLoadedInitially = false
|
||||
@State private var error: PollError?
|
||||
@State private var showJoinPoll = false
|
||||
@State private var joinCode = ""
|
||||
@@ -39,6 +40,8 @@ struct PollsListView: View {
|
||||
await loadPolls()
|
||||
}
|
||||
.task {
|
||||
guard !hasLoadedInitially else { return }
|
||||
hasLoadedInitially = true
|
||||
await loadPolls()
|
||||
}
|
||||
.alert("Join Poll", isPresented: $showJoinPoll) {
|
||||
@@ -87,7 +90,7 @@ struct PollsListView: View {
|
||||
}
|
||||
.listStyle(.plain)
|
||||
.navigationDestination(for: TripPoll.self) { poll in
|
||||
PollDetailView(pollId: poll.id)
|
||||
PollDetailView(poll: poll)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user