|
|
|
|
@ -9,12 +9,25 @@ import SwiftUI |
|
|
|
|
import PadelClubData |
|
|
|
|
|
|
|
|
|
struct TournamentFormatSelectionView: View { |
|
|
|
|
@EnvironmentObject var dataStore: DataStore |
|
|
|
|
@Environment(Tournament.self) private var tournament: Tournament |
|
|
|
|
@State private var globalFormat: MatchFormat = DataStore.shared.user.bracketMatchFormatPreference ?? .nineGamesDecisivePoint |
|
|
|
|
|
|
|
|
|
@ViewBuilder |
|
|
|
|
var body: some View { |
|
|
|
|
@Bindable var tournament = tournament |
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
|
MatchTypeSelectionView(selectedFormat: $globalFormat, format: "Tout") |
|
|
|
|
.onChange(of: globalFormat) { oldValue, newValue in |
|
|
|
|
tournament.matchFormat = newValue |
|
|
|
|
tournament.loserBracketMatchFormat = newValue |
|
|
|
|
tournament.groupStageMatchFormat = newValue |
|
|
|
|
} |
|
|
|
|
} footer: { |
|
|
|
|
Text("Modifier le format de tous les types de matchs") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Section { |
|
|
|
|
MatchTypeSelectionView(selectedFormat: $tournament.groupStageMatchFormat, format: "Poule", additionalEstimationDuration: tournament.additionalEstimationDuration) |
|
|
|
|
MatchTypeSelectionView(selectedFormat: $tournament.matchFormat, format: "Tableau", additionalEstimationDuration: tournament.additionalEstimationDuration) |
|
|
|
|
|