paca_championship
Raz 1 year ago
parent 3d00c58eb2
commit 87e4adf270
  1. 8
      PadelClub.xcodeproj/project.pbxproj
  2. 10
      PadelClub/Views/Match/Components/PlayerBlockView.swift
  3. 19
      PadelClub/Views/Match/MatchRowView.swift
  4. 27
      PadelClub/Views/Match/MatchSummaryView.swift

@ -3254,7 +3254,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 3;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3299,7 +3299,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 3;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;
@ -3415,7 +3415,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3459,7 +3459,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -71,16 +71,18 @@ struct PlayerBlockView: View {
var body: some View {
HStack {
VStack(alignment: .leading) {
if let names {
if let team {
if let teamScore, teamScore.luckyLoser != nil, match.isLoserBracket == false {
Text("Repêchée").italic().font(.caption)
}
if let teamName = team?.name {
if let teamName = team.name {
Text(teamName).foregroundStyle(.secondary).font(.footnote)
}
ForEach(names, id: \.self) { name in
Text(name).lineLimit(1)
ForEach(team.players()) { player in
Text(player.playerLabel()).lineLimit(1)
.italic(player.hasArrived == false)
.foregroundStyle(player.hasArrived == false ? .secondary : .primary)
}
} else {
ZStack(alignment: .leading) {

@ -6,6 +6,7 @@
//
import SwiftUI
import LeStorage
struct MatchRowView: View {
@ -63,6 +64,24 @@ struct MatchRowView: View {
} label: {
MatchSummaryView(match: match, matchViewStyle: matchViewStyle, title: title, updatedField: updatedField)
.contextMenu {
Section {
ForEach(match.teams().flatMap({ $0.players() })) { player in
Button {
player.hasArrived.toggle()
do {
try player.tournamentStore.playerRegistrations.addOrUpdate(instance: player)
} catch {
Logger.error(error)
}
} label: {
Label(player.playerLabel(), systemImage: player.hasArrived ? "checkmark" : "xmark")
}
}
} header: {
Text("Présence")
}
Divider()
NavigationLink {
EditSharingView(match: match)
} label: {

@ -65,7 +65,7 @@ struct MatchSummaryView: View {
VStack(alignment: .trailing, spacing: 0) {
if let courtName {
Text(courtName)
.strikethrough(match.courtIndex! != updatedField && match.isReady() && match.canBePlayedInSpecifiedCourt() == false)
.strikethrough(courtIsNotValid())
}
}
.foregroundStyle(.secondary)
@ -123,6 +123,31 @@ struct MatchSummaryView: View {
}
return updatedField
}
func courtIsNotValid() -> Bool {
if match.courtIndex == updatedField {
return false
}
if match.isReady() == false {
return false
}
if match.canBePlayedInSpecifiedCourt() {
return false
}
if let estimatedStartDate, estimatedStartDate.0 == updatedField {
return false
}
if let estimatedStartDate, estimatedStartDate.0 == match.courtIndex {
return false
}
return true
}
}
//#Preview {

Loading…
Cancel
Save