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 @Observable
class NavigationViewModel { class NavigationViewModel {
var path = NavigationPath()
var agendaDestination: AgendaDestination? = .activity var agendaDestination: AgendaDestination? = .activity
var tournament: Tournament? var tournament: Tournament?
} }

@ -52,8 +52,8 @@ struct ActivityView: View {
} }
var body: some View { var body: some View {
NavigationStack {
@Bindable var navigation = navigation @Bindable var navigation = navigation
NavigationStack(path: $navigation.path) {
VStack(spacing: 0) { VStack(spacing: 0) {
GenericDestinationPickerView(selectedDestination: $navigation.agendaDestination, destinations: AgendaDestination.allCases, nilDestinationIsValid: false) GenericDestinationPickerView(selectedDestination: $navigation.agendaDestination, destinations: AgendaDestination.allCases, nilDestinationIsValid: false)
List { List {
@ -187,16 +187,13 @@ struct ActivityView: View {
TournamentView() TournamentView()
.environment(tournament) .environment(tournament)
} }
.navigationDestination(item: $navigation.tournament) { tournament in
TournamentView()
.environment(tournament)
}
} }
} }
} }
private func _gatherFederalTournaments() { private func _gatherFederalTournaments() {
isGatheringFederalTournaments = true isGatheringFederalTournaments = true
NetworkFederalService.shared.formId = ""
Task { Task {
do { do {
try await dataStore.clubs.filter { $0.code != nil }.concurrentForEach { club in 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 { private func _buildView(_ build: any TournamentBuildHolder, existingTournament: Tournament?) -> some View {
HStack { HStack {
DateBoxView(date: tournament.startDate, displayStyle: .short) DateBoxView(date: tournament.startDate, displayStyle: displayStyle == .wide ? .short : .wide)
Rectangle() Rectangle()
.fill(color) .fill(color)
.frame(width: 2) .frame(width: 2)
@ -56,7 +56,7 @@ struct TournamentCellView: View {
Button { Button {
if let existingTournament { if let existingTournament {
navigation.agendaDestination = .activity navigation.agendaDestination = .activity
navigation.tournament = existingTournament navigation.path.append(existingTournament)
} else { } else {
let event = federalTournament.getEvent() let event = federalTournament.getEvent()
let newTournament = Tournament.newEmptyInstance() let newTournament = Tournament.newEmptyInstance()

Loading…
Cancel
Save