fix small bugs

multistore
Razmig Sarkissian 2 years ago
parent ebac3974c9
commit bb17216ec6
  1. 1
      PadelClub/ViewModel/NavigationViewModel.swift
  2. 7
      PadelClub/Views/Navigation/Agenda/ActivityView.swift
  3. 4
      PadelClub/Views/Tournament/Shared/TournamentCellView.swift

@ -9,6 +9,7 @@ import SwiftUI
@Observable
class NavigationViewModel {
var path = NavigationPath()
var agendaDestination: AgendaDestination? = .activity
var tournament: Tournament?
}

@ -52,8 +52,8 @@ struct ActivityView: View {
}
var body: some View {
NavigationStack {
@Bindable var navigation = navigation
NavigationStack(path: $navigation.path) {
VStack(spacing: 0) {
GenericDestinationPickerView(selectedDestination: $navigation.agendaDestination, destinations: AgendaDestination.allCases, nilDestinationIsValid: false)
List {
@ -187,16 +187,13 @@ struct ActivityView: View {
TournamentView()
.environment(tournament)
}
.navigationDestination(item: $navigation.tournament) { tournament in
TournamentView()
.environment(tournament)
}
}
}
}
private func _gatherFederalTournaments() {
isGatheringFederalTournaments = true
NetworkFederalService.shared.formId = ""
Task {
do {
try await dataStore.clubs.filter { $0.code != nil }.concurrentForEach { club in

@ -28,7 +28,7 @@ struct TournamentCellView: View {
private func _buildView(_ build: any TournamentBuildHolder, existingTournament: Tournament?) -> some View {
HStack {
DateBoxView(date: tournament.startDate, displayStyle: .short)
DateBoxView(date: tournament.startDate, displayStyle: displayStyle == .wide ? .short : .wide)
Rectangle()
.fill(color)
.frame(width: 2)
@ -56,7 +56,7 @@ struct TournamentCellView: View {
Button {
if let existingTournament {
navigation.agendaDestination = .activity
navigation.tournament = existingTournament
navigation.path.append(existingTournament)
} else {
let event = federalTournament.getEvent()
let newTournament = Tournament.newEmptyInstance()

Loading…
Cancel
Save