diff --git a/PadelClub.xcodeproj/project.pbxproj b/PadelClub.xcodeproj/project.pbxproj index 4984739..0b6ee7c 100644 --- a/PadelClub.xcodeproj/project.pbxproj +++ b/PadelClub.xcodeproj/project.pbxproj @@ -1906,7 +1906,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 88; + CURRENT_PROJECT_VERSION = 89; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; @@ -1950,7 +1950,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 88; + CURRENT_PROJECT_VERSION = 89; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_TEAM = BQ3Y44M3Q6; diff --git a/PadelClub/Assets.xcassets/logoRed.colorset/Contents.json b/PadelClub/Assets.xcassets/logoRed.colorset/Contents.json index 265a4eb..ded2ed9 100644 --- a/PadelClub/Assets.xcassets/logoRed.colorset/Contents.json +++ b/PadelClub/Assets.xcassets/logoRed.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "1.000", - "green" : "1.000", - "red" : "1.000" + "blue" : "0.220", + "green" : "0.251", + "red" : "0.910" } }, "idiom" : "universal" diff --git a/PadelClub/Data/Round.swift b/PadelClub/Data/Round.swift index 31e805c..3305cb6 100644 --- a/PadelClub/Data/Round.swift +++ b/PadelClub/Data/Round.swift @@ -556,7 +556,11 @@ defer { let currentRoundMatchCount = RoundRule.numberOfMatches(forRoundIndex: index) guard currentRoundMatchCount > 1 else { return } let roundCount = RoundRule.numberOfRounds(forTeams: currentRoundMatchCount) - let loserBracketMatchFormat = tournamentObject()?.loserBracketMatchFormat + + var loserBracketMatchFormat = tournamentObject()?.loserBracketMatchFormat + if let parentRound { + loserBracketMatchFormat = tournamentObject()?.loserBracketSmartMatchFormat(parentRound.index) + } let rounds = (0.. [TeamRegistration] { + let teams = selectedSortedTeams() + return waitingListTeams(in: teams) + } + + func selectedSortedTeams() -> [TeamRegistration] { #if DEBUG_TIME //DEBUGING TIME let start = Date() @@ -875,7 +881,7 @@ defer { return waitingList.filter { $0.walkOut == false }.sorted(using: _defaultSorting(), order: .ascending) + waitingList.filter { $0.walkOut == true }.sorted(using: _defaultSorting(), order: .ascending) } - func bracketCut() -> Int { + func bracketCut(teamCount: Int) -> Int { return max(0, teamCount - groupStageCut()) } @@ -883,10 +889,12 @@ defer { return groupStageSpots() } - func cutLabel(index: Int) -> String { - if index < bracketCut() { + func cutLabel(index: Int, teamCount: Int?) -> String { + let _teamCount = teamCount ?? selectedSortedTeams().count + let bracketCut = bracketCut(teamCount: _teamCount) + if index < bracketCut { return "Tableau" - } else if index - bracketCut() < groupStageCut() { + } else if index - bracketCut < groupStageCut() && _teamCount > 0 { return "Poule" } else { return "Attente" @@ -1543,7 +1551,7 @@ defer { var _groupStages = [GroupStage]() for index in 0..: .offset(x: 3, y: 3) } else if let count, count > 0 { Image(systemName: count <= 50 ? "\(String(count)).circle.fill" : "plus.circle.fill") - .foregroundColor(destination.badgeValueColor() ?? .red) + .foregroundColor(destination.badgeValueColor() ?? .logoRed) .imageScale(.medium) .background ( Color(.systemBackground) @@ -82,7 +82,7 @@ struct GenericDestinationPickerView: .offset(x: 3, y: 3) } else if let count = destination.badgeValue(), count > 0 { Image(systemName: count <= 50 ? "\(String(count)).circle.fill" : "plus.circle.fill") - .foregroundColor(destination.badgeValueColor() ?? .red) + .foregroundColor(destination.badgeValueColor() ?? .logoRed) .imageScale(.medium) .background ( Color(.systemBackground) diff --git a/PadelClub/Views/Components/RowButtonView.swift b/PadelClub/Views/Components/RowButtonView.swift index df2ea2e..6f741ed 100644 --- a/PadelClub/Views/Components/RowButtonView.swift +++ b/PadelClub/Views/Components/RowButtonView.swift @@ -87,7 +87,7 @@ struct RowButtonView: View { .disabled(isLoading) .frame(maxWidth: .infinity) .buttonStyle(.borderedProminent) - .tint(role == .destructive ? Color.red : Color.master) + .tint(role == .destructive ? Color.logoRed : Color.master) .listRowBackground(Color.clear) .listRowInsets(EdgeInsets(.zero)) .confirmationDialog("Confirmation", diff --git a/PadelClub/Views/Match/Components/MatchTeamDetailView.swift b/PadelClub/Views/Match/Components/MatchTeamDetailView.swift index 1ecdc93..eb4ad82 100644 --- a/PadelClub/Views/Match/Components/MatchTeamDetailView.swift +++ b/PadelClub/Views/Match/Components/MatchTeamDetailView.swift @@ -34,7 +34,7 @@ struct MatchTeamDetailView: View { EditablePlayerView(player: player, editingOptions: [.licenceId, .name, .payment]) } } header: { - TeamHeaderView(team: team, teamIndex: tournament?.indexOf(team: team), tournament: nil) + TeamHeaderView(team: team, teamIndex: tournament?.indexOf(team: team)) } } diff --git a/PadelClub/Views/Navigation/Umpire/UmpireView.swift b/PadelClub/Views/Navigation/Umpire/UmpireView.swift index 1254e6e..649a661 100644 --- a/PadelClub/Views/Navigation/Umpire/UmpireView.swift +++ b/PadelClub/Views/Navigation/Umpire/UmpireView.swift @@ -134,7 +134,7 @@ struct UmpireView: View { } else { LabeledContent { Image(systemName: "xmark.circle.fill") - .tint(.red) + .tint(.logoRed) } label: { if let _mostRecentDateAvailable { Text(_mostRecentDateAvailable.monthYearFormatted) diff --git a/PadelClub/Views/Planning/CourtAvailabilitySettingsView.swift b/PadelClub/Views/Planning/CourtAvailabilitySettingsView.swift index ff9f521..1140880 100644 --- a/PadelClub/Views/Planning/CourtAvailabilitySettingsView.swift +++ b/PadelClub/Views/Planning/CourtAvailabilitySettingsView.swift @@ -67,7 +67,7 @@ struct CourtAvailabilitySettingsView: View { VStack { Image(systemName: "arrowshape.forward.fill") .tint(.master) - Text("indisponible").foregroundStyle(.red).font(.caption) + Text("indisponible").foregroundStyle(.logoRed).font(.caption) } Spacer() VStack(alignment: .trailing, spacing: 0) { diff --git a/PadelClub/Views/Team/Components/TeamHeaderView.swift b/PadelClub/Views/Team/Components/TeamHeaderView.swift index b417e16..3e386cc 100644 --- a/PadelClub/Views/Team/Components/TeamHeaderView.swift +++ b/PadelClub/Views/Team/Components/TeamHeaderView.swift @@ -11,6 +11,7 @@ struct TeamHeaderView: View { var team: TeamRegistration var teamIndex: Int? var tournament: Tournament? + var teamCount: Int? var body: some View { HStack(spacing: 16.0) { @@ -46,7 +47,7 @@ struct TeamHeaderView: View { } else { Text("").font(.caption) } - Text(tournament.cutLabel(index: teamIndex)) + Text(tournament.cutLabel(index: teamIndex, teamCount: teamCount)) } } } diff --git a/PadelClub/Views/Team/TeamRowView.swift b/PadelClub/Views/Team/TeamRowView.swift index e9c97bb..65b0ce0 100644 --- a/PadelClub/Views/Team/TeamRowView.swift +++ b/PadelClub/Views/Team/TeamRowView.swift @@ -26,7 +26,7 @@ struct TeamRowView: View { } if let callDate = team.callDate, displayCallDate { Text("Déjà convoquée \(callDate.localizedDate())") - .foregroundStyle(.red) + .foregroundStyle(.logoRed) .italic() .font(.caption) } diff --git a/PadelClub/Views/Tournament/FileImportView.swift b/PadelClub/Views/Tournament/FileImportView.swift index 4db4bef..939a278 100644 --- a/PadelClub/Views/Tournament/FileImportView.swift +++ b/PadelClub/Views/Tournament/FileImportView.swift @@ -492,7 +492,7 @@ struct FileImportView: View { } if let callDate = team.previousTeam?.callDate, let newDate = tournament.getStartDate(ofSeedIndex: newIndex), callDate != newDate { Text("Attention, cette paire a déjà été convoquée à \(callDate.localizedDate())") - .foregroundStyle(.red) + .foregroundStyle(.logoRed) .italic() .font(.caption) } diff --git a/PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift b/PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift index 8555e71..72d5b1d 100644 --- a/PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift +++ b/PadelClub/Views/Tournament/Screen/Components/InscriptionInfoView.swift @@ -91,7 +91,7 @@ struct InscriptionInfoView: View { Text("Dans le tableau") } } - .listRowView(color: .red) + .listRowView(color: .logoRed) DisclosureGroup { ForEach(waitingListInGroupStage) { team in @@ -104,7 +104,7 @@ struct InscriptionInfoView: View { Text("En poule") } } - .listRowView(color: .red) + .listRowView(color: .logoRed) } header: { Text("Équipes ne devant plus être sélectionnées") } footer: { @@ -123,7 +123,7 @@ struct InscriptionInfoView: View { Text("Doublons") } } - .listRowView(color: .red) + .listRowView(color: .logoRed) } Section { @@ -155,7 +155,7 @@ struct InscriptionInfoView: View { Text("Joueurs trop bien classés") } } - .listRowView(color: .red) + .listRowView(color: .logoRed) } footer: { Text("Il s'agit des joueurs ou joueuses dont le rang est inférieur à la limite fédérale.") } diff --git a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift index acc889e..eec62b5 100644 --- a/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift +++ b/PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift @@ -98,6 +98,7 @@ struct InscriptionManagerView: View { var id: Int { self.rawValue } case all case walkOut + case waiting func localizedLabel() -> String { switch self { @@ -105,6 +106,8 @@ struct InscriptionManagerView: View { return "Toutes les équipes" case .walkOut: return "Voir les WOs" + case .waiting: + return "Liste d'attente" } } } @@ -468,7 +471,11 @@ struct InscriptionManagerView: View { print("func _prepareTeams", duration.formatted(.units(allowed: [.seconds, .milliseconds]))) } #endif - sortedTeams = tournament.sortedTeams() + if filterMode == .waiting { + sortedTeams = tournament.waitingListSortedTeams() + } else { + sortedTeams = tournament.sortedTeams() + } } var filteredTeams: [TeamRegistration] { @@ -511,12 +518,19 @@ struct InscriptionManagerView: View { private func _teamRegisteredView() -> some View { List { + let selectedSortedTeams = tournament.selectedSortedTeams() if let closedRegistrationDate = tournament.closedRegistrationDate { Section { CloseDatePicker(closedRegistrationDate: closedRegistrationDate) } footer: { Text("Toutes les équipes ayant été inscrites après la date de clôture seront en liste d'attente.") } + + if selectedSortedTeams.isEmpty { + Section { + ContentUnavailableView("Aucune équipe", systemImage: "person.2.slash", description: Text("Vous n'avez aucune équipe inscrite avant la date de clôture.")) + } + } } if presentSearch == false { @@ -560,7 +574,7 @@ struct InscriptionManagerView: View { Section { TeamDetailView(team: team) } header: { - TeamHeaderView(team: team, teamIndex: teamIndex, tournament: tournament) + TeamHeaderView(team: team, teamIndex: teamIndex, tournament: tournament, teamCount: filterMode == .waiting ? 0 : selectedSortedTeams.count) } footer: { _teamFooterView(team) } @@ -722,7 +736,7 @@ struct InscriptionManagerView: View { } Section { - ContentUnavailableView("Aucune équipe", systemImage: "person.2.slash", description: Text("Vous n'avez encore aucune équipe dans votre liste d'attente.")) + ContentUnavailableView("Aucune équipe", systemImage: "person.2.slash", description: Text("Vous n'avez encore aucune équipe inscrite dans votre tournoi.")) } _rankHandlerView() diff --git a/PadelClub/Views/Tournament/Screen/TournamentRankView.swift b/PadelClub/Views/Tournament/Screen/TournamentRankView.swift index 5470062..03386c3 100644 --- a/PadelClub/Views/Tournament/Screen/TournamentRankView.swift +++ b/PadelClub/Views/Tournament/Screen/TournamentRankView.swift @@ -213,7 +213,7 @@ struct TournamentRankView: View { Image(systemName: "arrowtriangle.down.fill") .imageScale(.small) } - .foregroundColor(.red) + .foregroundColor(.logoRed) } else { Text("--") } diff --git a/PadelClub/Views/Tournament/TournamentBuildView.swift b/PadelClub/Views/Tournament/TournamentBuildView.swift index 7fd9163..ace1ac3 100644 --- a/PadelClub/Views/Tournament/TournamentBuildView.swift +++ b/PadelClub/Views/Tournament/TournamentBuildView.swift @@ -102,7 +102,7 @@ struct TournamentBuildView: View { } label: { Text("Classement final des équipes") if tournament.publishRankings == false { - Text("Vérifiez le classement avant de publier").foregroundStyle(.red) + Text("Vérifiez le classement avant de publier").foregroundStyle(.logoRed) } } } @@ -120,7 +120,7 @@ struct TournamentBuildView: View { } label: { Text("Classement final des équipes") if tournament.publishRankings == false { - Text("Vérifiez le classement avant de publier").foregroundStyle(.red) + Text("Vérifiez le classement avant de publier").foregroundStyle(.logoRed) } } } diff --git a/PadelClub/Views/User/ChangePasswordView.swift b/PadelClub/Views/User/ChangePasswordView.swift index a0e47b6..544a27c 100644 --- a/PadelClub/Views/User/ChangePasswordView.swift +++ b/PadelClub/Views/User/ChangePasswordView.swift @@ -46,7 +46,7 @@ struct ChangePasswordView: View { .frame(maxWidth: .infinity) } footer: { if self.errorMessage.count > 0 { - Text(self.errorMessage).foregroundStyle(.red) + Text(self.errorMessage).foregroundStyle(.logoRed) } } } diff --git a/PadelClub/Views/User/LoginView.swift b/PadelClub/Views/User/LoginView.swift index cb36838..61c27fe 100644 --- a/PadelClub/Views/User/LoginView.swift +++ b/PadelClub/Views/User/LoginView.swift @@ -131,7 +131,7 @@ struct LoginView: View { } .disabled(password.isEmpty || username.isEmpty) // if let error = self.errorText { -// Text(error).font(.callout).foregroundStyle(.red) +// Text(error).font(.callout).foregroundStyle(.logoRed) // } }