|
|
|
|
@ -12,6 +12,7 @@ struct GroupStageSettingsView: View { |
|
|
|
|
@EnvironmentObject var dataStore: DataStore |
|
|
|
|
@Environment(Tournament.self) var tournament: Tournament |
|
|
|
|
@State private var nameAlphabetical: Bool = false |
|
|
|
|
@State private var generationDone: Bool = false |
|
|
|
|
|
|
|
|
|
let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
|
|
|
|
|
|
|
|
|
@ -58,6 +59,13 @@ struct GroupStageSettingsView: View { |
|
|
|
|
Text("Nommer les poules alphabétiquement") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.overlay(alignment: .bottom) { |
|
|
|
|
if generationDone { |
|
|
|
|
Label("Poules mises à jour", systemImage: "checkmark.circle.fill") |
|
|
|
|
.toastFormatted() |
|
|
|
|
.deferredRendering(for: .seconds(2)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.onChange(of: nameAlphabetical) { |
|
|
|
|
let groupStages = tournament.groupStages() |
|
|
|
|
if nameAlphabetical { |
|
|
|
|
@ -78,6 +86,7 @@ struct GroupStageSettingsView: View { |
|
|
|
|
RowButtonView("Refaire les poules", role: .destructive) { |
|
|
|
|
tournament.deleteGroupStages() |
|
|
|
|
tournament.buildGroupStages() |
|
|
|
|
generationDone = true |
|
|
|
|
_save() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -87,6 +96,7 @@ struct GroupStageSettingsView: View { |
|
|
|
|
RowButtonView("Poule \(mode.localizedLabel().lowercased())", role: .destructive, systemImage: mode.systemImage) { |
|
|
|
|
tournament.groupStageOrderingMode = mode |
|
|
|
|
tournament.refreshGroupStages() |
|
|
|
|
generationDone = true |
|
|
|
|
_save() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|