You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
PadelClub/PadelClub/Views/Tournament/TournamentBuildView.swift

91 lines
2.9 KiB

//
// TournamentBuildView.swift
// PadelClub
//
// Created by Razmig Sarkissian on 19/05/2024.
//
import SwiftUI
struct TournamentBuildView: View {
var tournament: Tournament
@ViewBuilder
var body: some View {
if tournament.hasEnded() {
Section {
NavigationLink(value: Screen.rankings) {
Text("Classement")
}
}
}
Section {
if tournament.groupStageCount > 0 {
NavigationLink(value: Screen.groupStage) {
LabeledContent {
Text(tournament.groupStageStatus())
} label: {
Text("Poules")
if tournament.shouldVerifyGroupStage {
Text("Veuillez vérifier les poules").foregroundStyle(.logoRed)
}
}
}
}
if tournament.rounds().isEmpty == false {
NavigationLink(value: Screen.round) {
LabeledContent {
Text(tournament.bracketStatus())
} label: {
Text("Tableau")
if tournament.shouldVerifyBracket {
Text("Veuillez vérifier la tableau").foregroundStyle(.logoRed)
}
}
}
}
}
Section {
if tournament.state() != .finished {
NavigationLink(value: Screen.schedule) {
let tournamentStatus = tournament.scheduleStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Horaires")
Text(tournamentStatus.label)
}
}
NavigationLink(value: Screen.call) {
let tournamentStatus = tournament.callStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Convocations")
Text(tournamentStatus.label)
}
}
}
if tournament.state() == .running || tournament.state() == .finished {
NavigationLink(value: Screen.cashier) {
let tournamentStatus = tournament.cashierStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Encaissement")
Text(tournamentStatus.label)
}
}
}
}
}
}
#Preview {
TournamentBuildView(tournament: Tournament.mock())
}