@ -15,6 +15,7 @@ struct TournamentCellView: View {
let tournament : FederalTournamentHolder
let tournament : FederalTournamentHolder
// l e t c o l o r : C o l o r = . b l a c k
// l e t c o l o r : C o l o r = . b l a c k
var displayStyle : DisplayStyle = . wide
var displayStyle : DisplayStyle = . wide
var shouldTournamentBeOver : Bool = false
var event : Event ? {
var event : Event ? {
guard let federalTournament = tournament as ? FederalTournament else { return nil }
guard let federalTournament = tournament as ? FederalTournament else { return nil }
@ -115,8 +116,9 @@ struct TournamentCellView: View {
if let tournament = tournament as ? Tournament , displayStyle = = . wide {
if let tournament = tournament as ? Tournament , displayStyle = = . wide {
if tournament . isCanceled {
if tournament . isCanceled {
Text ( " Annulé " . uppercased ( ) )
Text ( " Annulé " . uppercased ( ) )
. capsule ( foreground : . white , background : . red )
. capsule ( foreground : . white , background : . logoRed )
} else if shouldTournamentBeOver {
Image ( systemName : " clock.badge.questionmark " ) . foregroundStyle ( . logoRed )
} else if let teamCount {
} else if let teamCount {
Text ( teamCount . formatted ( ) )
Text ( teamCount . formatted ( ) )
}
}
@ -147,12 +149,17 @@ struct TournamentCellView: View {
Text ( tournament . durationLabel ( ) )
Text ( tournament . durationLabel ( ) )
}
}
Spacer ( )
Spacer ( )
if let tournament = tournament as ? Tournament , tournament . isCanceled = = false , let teamCount {
if let tournament = tournament as ? Tournament , tournament . isCanceled = = false {
if shouldTournamentBeOver {
Text ( " à clôturer ? " )
. foregroundStyle ( . logoRed )
} else if let teamCount {
let hasStarted = tournament . inscriptionClosed ( ) || tournament . hasStarted ( )
let hasStarted = tournament . inscriptionClosed ( ) || tournament . hasStarted ( )
let word = hasStarted ? " équipe " : " inscription "
let word = hasStarted ? " équipe " : " inscription "
Text ( word + teamCount . pluralSuffix )
Text ( word + teamCount . pluralSuffix )
}
}
}
}
}
} else {
} else {
Text ( build . category . localizedLabel ( ) )
Text ( build . category . localizedLabel ( ) )
Text ( build . age . localizedFederalAgeLabel ( ) )
Text ( build . age . localizedFederalAgeLabel ( ) )
@ -160,7 +167,6 @@ struct TournamentCellView: View {
}
}
}
}
. font ( . caption )
. font ( . caption )
. listRowView ( isActive : existingTournament != nil , color : . green , hideColorVariation : true , alignment : . leading )
}
}
private func _createOrShow ( federalTournament : FederalTournament , existingTournament : Tournament ? , build : any TournamentBuildHolder ) {
private func _createOrShow ( federalTournament : FederalTournament , existingTournament : Tournament ? , build : any TournamentBuildHolder ) {