fix ongoing

main
Razmig Sarkissian 2 weeks ago
parent a16897f3ed
commit d9657ace50
  1. 17
      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<String> = Set() {
didSet {
DataStore.shared.resetOngoingCache()
}
}
var selectedTournaments: Set<String> = 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: {

Loading…
Cancel
Save