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.
66 lines
2.1 KiB
66 lines
2.1 KiB
//
|
|
// TeamRowView.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Razmig Sarkissian on 24/03/2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct TeamRowView: View {
|
|
var team: TeamRegistration
|
|
var teamPosition: TeamPosition? = nil
|
|
var displayCallDate: Bool = false
|
|
|
|
var body: some View {
|
|
LabeledContent {
|
|
TeamWeightView(team: team, teamPosition: teamPosition)
|
|
} label: {
|
|
VStack(alignment: .leading) {
|
|
if let groupStage = team.groupStageObject() {
|
|
HStack {
|
|
Text(groupStage.groupStageTitle())
|
|
if let finalPosition = groupStage.finalPosition(ofTeam: team) {
|
|
Text((finalPosition + 1).ordinalFormatted())
|
|
}
|
|
}
|
|
} else if let round = team.initialRound() {
|
|
Text(round.roundTitle(.wide))
|
|
}
|
|
|
|
if let name = team.name {
|
|
Text(name).font(.title3)
|
|
if team.players().isEmpty {
|
|
Text("Aucun joueur")
|
|
}
|
|
} else {
|
|
if team.players().isEmpty == false {
|
|
ForEach(team.players()) { player in
|
|
Text(player.playerLabel())
|
|
}
|
|
} else {
|
|
Text("Place réservée")
|
|
Text("Place réservée")
|
|
}
|
|
}
|
|
}
|
|
if displayCallDate {
|
|
if let callDate = team.callDate {
|
|
Text("Déjà convoquée \(callDate.localizedDate())")
|
|
.foregroundStyle(.logoRed)
|
|
.italic()
|
|
.font(.caption)
|
|
} else {
|
|
Text("Pas encore convoquée")
|
|
.foregroundStyle(.logoRed)
|
|
.italic()
|
|
.font(.caption)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//#Preview {
|
|
// TeamRowView(team: TeamRegistration.mock())
|
|
//}
|
|
|