diff --git a/PadelClub/Views/Match/MatchSummaryView.swift b/PadelClub/Views/Match/MatchSummaryView.swift index 3f63c16..84ec569 100644 --- a/PadelClub/Views/Match/MatchSummaryView.swift +++ b/PadelClub/Views/Match/MatchSummaryView.swift @@ -19,6 +19,7 @@ struct MatchSummaryView: View { let color: Color let width: CGFloat let updatedField: Int? + let estimatedStartDate: Match.CourtIndexAndDate? init(match: Match, matchViewStyle: MatchViewStyle, title: String? = nil, updatedField: Int? = nil) { self.match = match @@ -44,6 +45,8 @@ struct MatchSummaryView: View { } else { self.courtName = nil } + + self.estimatedStartDate = match.estimatedStartDate() } var body: some View { @@ -67,11 +70,13 @@ struct MatchSummaryView: View { } else if let first = match.availableCourts().first { Text("possible") Text(match.courtName(for: first)) - } else if let estimatedStartDate = match.estimatedStartDate() { + } else if let estimatedStartDate { Text(match.courtName(for: estimatedStartDate.0) + " possible") Text("dans ~ " + estimatedStartDate.1.timeElapsedString()) + } else if let courtName { + Text(courtName) } else { - Text("aucun terrain disponible") + Text("") } } else if let courtName { Text(courtName) @@ -111,7 +116,7 @@ struct MatchSummaryView: View { .foregroundStyle(.secondary) } Spacer() - MatchDateView(match: match, showPrefix: matchViewStyle == .tournamentResultStyle, updatedField: updatedField) + MatchDateView(match: match, showPrefix: matchViewStyle == .tournamentResultStyle, updatedField: updatedField ?? estimatedStartDate?.0) } } } diff --git a/PadelClub/Views/Navigation/Ongoing/OngoingContainerView.swift b/PadelClub/Views/Navigation/Ongoing/OngoingContainerView.swift index 1946c24..aa16926 100644 --- a/PadelClub/Views/Navigation/Ongoing/OngoingContainerView.swift +++ b/PadelClub/Views/Navigation/Ongoing/OngoingContainerView.swift @@ -27,14 +27,10 @@ class OngoingViewModel { } var filteredRunningAndNextMatches: [Match] { - if destination == .followUp { - return runningAndNextMatches.filter({ - (hideUnconfirmedMatches == false || hideUnconfirmedMatches == true && $0.confirmed) - && (hideNotReadyMatches == false || hideNotReadyMatches == true && $0.isReady() ) - }) - } else { - return runningAndNextMatches - } + return runningAndNextMatches.filter({ + (hideUnconfirmedMatches == false || hideUnconfirmedMatches == true && $0.confirmed) + && (hideNotReadyMatches == false || hideNotReadyMatches == true && $0.isReady() ) + }) } } @@ -56,7 +52,6 @@ struct OngoingContainerView: View { OngoingCourtView() } } - .toolbarBackground(.visible, for: .bottomBar) .navigationBarTitleDisplayMode(.inline) .toolbarBackground(.visible, for: .navigationBar) .navigationTitle("Programmation") diff --git a/PadelClub/Views/Navigation/Ongoing/OngoingView.swift b/PadelClub/Views/Navigation/Ongoing/OngoingView.swift index d36fd40..4335f39 100644 --- a/PadelClub/Views/Navigation/Ongoing/OngoingView.swift +++ b/PadelClub/Views/Navigation/Ongoing/OngoingView.swift @@ -91,14 +91,13 @@ struct OngoingCourtView: View { if (filterMode == .free && courtFilteredMatches.isEmpty) || (filterMode == .court && courtFilteredMatches.isEmpty == false) { Section { MatchListView(section: "En cours", matches: courtFilteredMatches, hideWhenEmpty: true, isExpanded: false) - if courtFilteredMatches.isEmpty { - Button("Choisir un match") { - selectedCourtForFollowUp = index - } - } MatchListView(section: "À venir", matches: sortedMatches.filter({ $0.courtIndex == index && $0.hasStarted() == false }), isExpanded: false) } header: { Text(title) + } footer: { + FooterButtonView("Ajouter un match à suivre") { + selectedCourtForFollowUp = index + } } } } diff --git a/PadelClub/Views/Score/FollowUpMatchView.swift b/PadelClub/Views/Score/FollowUpMatchView.swift index 2356a69..30bb84d 100644 --- a/PadelClub/Views/Score/FollowUpMatchView.swift +++ b/PadelClub/Views/Score/FollowUpMatchView.swift @@ -196,8 +196,32 @@ struct FollowUpMatchView: View { if sortedMatches.isEmpty == false { ForEach(sortedMatches) { match in + let tournament = match.currentTournament() Section { MatchRowView(match: match, matchViewStyle: .followUpStyle, updatedField: selectedCourt) + } header: { + if let tournament { + HStack { + Text(tournament.tournamentTitle(.short)) + Spacer() + if let club = tournament.club() { + Text("@" + club.clubTitle(.short)) + } + } + } + } footer: { + HStack { + if let tournament { + Text(tournament.eventLabel()) + } + #if DEBUG + Spacer() + FooterButtonView("copier l'id") { + let pasteboard = UIPasteboard.general + pasteboard.string = match.id + } + #endif + } } } } else { @@ -243,7 +267,7 @@ struct FollowUpMatchView: View { ToolbarItem(placement: .topBarTrailing) { Picker(selection: $selectedCourt) { - Text("choix du terrain").tag(nil as Int?) + Image(systemName: "sportscourt").tag(nil as Int?) if let tournament = match?.currentTournament() { ForEach(0..