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.
45 lines
1.2 KiB
45 lines
1.2 KiB
//
|
|
// MatchTeamDetailView.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Razmig Sarkissian on 18/04/2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct MatchTeamDetailView: View {
|
|
let match: Match
|
|
|
|
var body: some View {
|
|
NavigationStack {
|
|
let tournament = match.currentTournament()
|
|
List {
|
|
if let teamOne = match.team(.one) {
|
|
_teamDetailView(teamOne, inTournament: tournament)
|
|
}
|
|
if let teamTwo = match.team(.two) {
|
|
_teamDetailView(teamTwo, inTournament: tournament)
|
|
}
|
|
}
|
|
.headerProminence(.increased)
|
|
.tint(.master)
|
|
}
|
|
.presentationDetents([.fraction(0.66)])
|
|
}
|
|
|
|
@ViewBuilder
|
|
private func _teamDetailView(_ team: TeamRegistration, inTournament tournament: Tournament?) -> some View {
|
|
Section {
|
|
ForEach(team.players()) { player in
|
|
EditablePlayerView(player: player, editingOptions: [.licenceId, .payment])
|
|
}
|
|
} header: {
|
|
TeamHeaderView(team: team, teamIndex: tournament?.indexOf(team: team), tournament: nil)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#Preview {
|
|
MatchTeamDetailView(match: Match.mock())
|
|
}
|
|
|