add global format picker

wording
main
Razmig Sarkissian 1 month ago
parent 15ae97faf5
commit 05f132316c
  1. 4
      PadelClub/Views/Tournament/Screen/Components/HeadManagerView.swift
  2. 15
      PadelClub/Views/Tournament/Screen/Components/TournamentFormatSelectionView.swift

@ -25,7 +25,7 @@ struct HeadManagerView: View {
Text(RoundRule.roundName(fromRoundIndex: $0)).tag($0)
}
} label: {
Text("Premier tour")
Text("Tour contenant la meilleure tête de série")
}
.onChange(of: initialSeedRound) {
initialSeedCount = RoundRule.numberOfMatches(forRoundIndex: initialSeedRound)
@ -34,7 +34,7 @@ struct HeadManagerView: View {
LabeledContent {
StepperView(count: $initialSeedCount, minimum: 0, maximum: RoundRule.numberOfMatches(forRoundIndex: initialSeedRound))
} label: {
Text("Têtes de série")
Text("Nombre de tête de série")
}
}
}

@ -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)

Loading…
Cancel
Save