diff --git a/PadelClub/Views/Navigation/Ongoing/OngoingContainerView.swift b/PadelClub/Views/Navigation/Ongoing/OngoingContainerView.swift index bc53bc7..5bf9d10 100644 --- a/PadelClub/Views/Navigation/Ongoing/OngoingContainerView.swift +++ b/PadelClub/Views/Navigation/Ongoing/OngoingContainerView.swift @@ -16,11 +16,7 @@ class OngoingViewModel { var destination: OngoingDestination? = .running var hideUnconfirmedMatches: Bool = false var hideNotReadyMatches: Bool = false - var selectedTournaments: Set = Set() { - didSet { - DataStore.shared.resetOngoingCache() - } - } + var selectedTournaments: Set = Set() func tournaments() -> [Tournament] { Set(DataStore.shared.runningAndNextMatches().compactMap({ $0.currentTournament() })).sorted(by: \.startDate) @@ -75,20 +71,23 @@ struct OngoingContainerView: View { .tag(tournament.id) } } + .onChange(of: ongoingViewModel.selectedTournaments, { oldValue, newValue in + DataStore.shared.resetOngoingCache() + }) .environment(\.editMode, Binding.constant(EditMode.active)) - .navigationTitle("Tournois visibles") + .navigationTitle("Tournois à masquer") .navigationBarTitleDisplayMode(.inline) .toolbarBackground(.visible, for: .navigationBar) } label: { - Label("Tournois visibles", systemImage: "circle.grid.2x2.topleft.checkmark.filled") + Label("Masquer des tournois", systemImage: "circle.grid.2x2.topleft.checkmark.filled") } if ongoingViewModel.destination == .followUp { Divider() Toggle(isOn: $ongoingViewModel.hideUnconfirmedMatches) { - Text("masquer non confirmés") + Text("Masquer non confirmés") } Toggle(isOn: $ongoingViewModel.hideNotReadyMatches) { - Text("masquer incomplets") + Text("Masquer incomplets") } } } label: {