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:
Trey t
2026-01-14 09:35:18 -06:00
parent fe36f99bca
commit d034ee8612
22 changed files with 422 additions and 242 deletions

View File

@@ -25,15 +25,19 @@ final class PollDetailViewModel {
return PollResults(poll: poll, votes: votes)
}
func checkIsOwner() async -> Bool {
guard let poll else { return false }
do {
let userId = try await pollService.getCurrentUserRecordID()
return poll.ownerId == userId
} catch {
return false
}
}
var isOwner: Bool {
get async {
guard let poll else { return false }
do {
let userId = try await pollService.getCurrentUserRecordID()
return poll.ownerId == userId
} catch {
return false
}
await checkIsOwner()
}
}
@@ -98,6 +102,32 @@ final class PollDetailViewModel {
isLoading = false
}
/// Load poll from an existing object (avoids CloudKit fetch delay)
func loadPoll(from existingPoll: TripPoll) async {
isLoading = true
error = nil
self.poll = existingPoll
do {
// Still fetch votes and subscription from CloudKit
async let votesTask = pollService.fetchVotes(forPollId: existingPoll.id)
async let myVoteTask = pollService.fetchMyVote(forPollId: existingPoll.id)
let (fetchedVotes, fetchedMyVote) = try await (votesTask, myVoteTask)
self.votes = fetchedVotes
self.myVote = fetchedMyVote
// Subscribe to vote updates
try? await pollService.subscribeToVoteUpdates(forPollId: existingPoll.id)
} catch {
// Votes fetch failed, but we have the poll - non-critical error
self.votes = []
}
isLoading = false
}
func refresh() async {
guard let poll else { return }