parent
6d28930359
commit
d85e22c9ff
@ -0,0 +1,18 @@ |
||||
// |
||||
// FooterButtonView.swift |
||||
// PadelClub |
||||
// |
||||
// Created by Razmig Sarkissian on 18/04/2024. |
||||
// |
||||
|
||||
import SwiftUI |
||||
|
||||
struct FooterButtonView: View { |
||||
var body: some View { |
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) |
||||
} |
||||
} |
||||
|
||||
#Preview { |
||||
FooterButtonView() |
||||
} |
||||
@ -0,0 +1,45 @@ |
||||
// |
||||
// 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()) |
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
// |
||||
// TeamHeaderView.swift |
||||
// PadelClub |
||||
// |
||||
// Created by Razmig Sarkissian on 18/04/2024. |
||||
// |
||||
|
||||
import SwiftUI |
||||
|
||||
struct TeamHeaderView: View { |
||||
var team: TeamRegistration |
||||
var teamIndex: Int? |
||||
var tournament: Tournament? |
||||
|
||||
var body: some View { |
||||
_teamHeaderView(team, teamIndex: teamIndex) |
||||
} |
||||
|
||||
private func _teamHeaderView(_ team: TeamRegistration, teamIndex: Int?) -> some View { |
||||
HStack { |
||||
if let teamIndex { |
||||
Text("#" + (teamIndex + 1).formatted()) |
||||
} |
||||
|
||||
if team.unsortedPlayers().isEmpty == false { |
||||
Text(team.weight.formatted()) |
||||
} |
||||
if team.isWildCard() { |
||||
Text("wildcard").italic().font(.caption) |
||||
} |
||||
Spacer() |
||||
if team.walkOut { |
||||
Text("WO") |
||||
} else if let teamIndex, let tournament { |
||||
Text(tournament.cutLabel(index: teamIndex)) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
#Preview { |
||||
TeamHeaderView(team: TeamRegistration.mock(), teamIndex: 1, tournament: nil) |
||||
} |
||||
@ -0,0 +1,38 @@ |
||||
// |
||||
// TeamWeightView.swift |
||||
// PadelClub |
||||
// |
||||
// Created by Razmig Sarkissian on 18/04/2024. |
||||
// |
||||
|
||||
import SwiftUI |
||||
|
||||
struct TeamWeightView: View { |
||||
var team: TeamRegistration |
||||
var teamPosition: TeamPosition? = nil |
||||
|
||||
var body: some View { |
||||
VStack(alignment: .trailing, spacing: 0) { |
||||
if teamPosition == .one || teamPosition == nil { |
||||
Text(team.weight.formatted()) |
||||
.monospacedDigit() |
||||
.font(.caption) |
||||
} |
||||
if let teams = team.tournamentObject()?.selectedSortedTeams(), let index = team.index(in: teams) { |
||||
Text("#" + (index + 1).formatted(.number.precision(.integerLength(2...3)))) |
||||
.monospacedDigit() |
||||
.font(.title) |
||||
} |
||||
if teamPosition == .two { |
||||
Text(team.weight.formatted()) |
||||
.monospacedDigit() |
||||
.font(.caption) |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
#Preview { |
||||
TeamWeightView(team: TeamRegistration.mock(), teamPosition: .one) |
||||
} |
||||
Loading…
Reference in new issue