add resting time

paca_championship
Raz 1 year ago
parent b5041db0db
commit d4fedd862b
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 1
      PadelClub/ViewModel/Screen.swift
  3. 79
      PadelClub/Views/Team/TeamRestingView.swift
  4. 4
      PadelClub/Views/Tournament/TournamentBuildView.swift
  5. 11
      PadelClub/Views/Tournament/TournamentRunningView.swift
  6. 2
      PadelClub/Views/Tournament/TournamentView.swift

@ -3174,7 +3174,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3219,7 +3219,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -20,4 +20,5 @@ enum Screen: String, Codable {
case broadcast
case event
case print
case restingTime
}

@ -8,13 +8,11 @@
import SwiftUI
struct TeamRestingView: View {
@Environment(Tournament.self) var tournament
let readyMatches: [Match]
let matchesLeft: [Match]
@Environment(Tournament.self) var tournament: Tournament
@State private var sortingMode: SortingMode = .restingTime
@State private var selectedCourt: Int?
@State private var readyMatches: [Match] = []
@State private var matchesLeft: [Match] = []
enum SortingMode: Int, Identifiable, CaseIterable {
var id: Int { self.rawValue }
@ -65,17 +63,16 @@ struct TeamRestingView: View {
}
var body: some View {
NavigationStack {
List {
Section {
Picker(selection: $selectedCourt) {
Text("Aucun").tag(nil as Int?)
ForEach(0..<tournament.courtCount, id: \.self) { courtIndex in
Text(tournament.courtName(atIndex: courtIndex)).tag(courtIndex as Int?)
}
} label: {
Text("Sur le terrain")
List {
Section {
Picker(selection: $selectedCourt) {
Text("Aucun").tag(nil as Int?)
ForEach(0..<tournament.courtCount, id: \.self) { courtIndex in
Text(tournament.courtName(atIndex: courtIndex)).tag(courtIndex as Int?)
}
} label: {
Text("Sur le terrain")
}
//
// Toggle(isOn: $checkCanPlay) {
// if isFree {
@ -90,34 +87,40 @@ struct TeamRestingView: View {
// } else {
// Text("Masque les matchs où un ou plusieurs joueurs n'ont pas encore réglé ou qui ne sont pas encore arrivé")
// }
}
}
Section {
if sortedMatches.isEmpty == false {
ForEach(sortedMatches) { match in
MatchRowView(match: match, matchViewStyle: .followUpStyle, updatedField: selectedCourt)
}
} else {
ContentUnavailableView("Aucun match à venir", systemImage: "xmark.circle", description: Text(contentUnavailableDescriptionLabel()))
Section {
if sortedMatches.isEmpty == false {
ForEach(sortedMatches) { match in
MatchRowView(match: match, matchViewStyle: .followUpStyle, updatedField: selectedCourt)
}
} header: {
Picker(selection: $sortingMode) {
ForEach(sortingModeCases) { sortingMode in
Text(sortingMode.localizedSortingModeLabel()).tag(sortingMode)
}
} label: {
Text("Méthode de tri")
} else {
ContentUnavailableView("Aucun match à venir", systemImage: "xmark.circle", description: Text(contentUnavailableDescriptionLabel()))
}
} header: {
Picker(selection: $sortingMode) {
ForEach(sortingModeCases) { sortingMode in
Text(sortingMode.localizedSortingModeLabel()).tag(sortingMode)
}
.labelsHidden()
.pickerStyle(.segmented)
.fixedSize()
} label: {
Text("Méthode de tri")
}
.headerProminence(.increased)
.textCase(nil)
.labelsHidden()
.pickerStyle(.segmented)
}
.toolbarBackground(.visible, for: .navigationBar)
.navigationTitle("Match à suivre")
.navigationBarTitleDisplayMode(.inline)
.headerProminence(.increased)
.textCase(nil)
}
.toolbarBackground(.visible, for: .navigationBar)
.navigationTitle("Match à suivre")
.navigationBarTitleDisplayMode(.inline)
.onAppear {
let allMatches = tournament.allMatches()
let matchesLeft = tournament.matchesLeft(allMatches)
let runningMatches = tournament.runningMatches(allMatches)
let readyMatches = tournament.readyMatches(allMatches)
self.readyMatches = tournament.availableToStart(readyMatches, in: runningMatches, checkCanPlay: false)
self.matchesLeft = matchesLeft
}
}
}

@ -130,6 +130,10 @@ struct TournamentBuildView: View {
}
}
}
} else {
NavigationLink(value: Screen.restingTime) {
Text("Temps de repos")
}
}
if state == .running || state == .finished {
TournamentInscriptionView(tournament: tournament)

@ -19,19 +19,8 @@ struct TournamentRunningView: View {
@ViewBuilder
var body: some View {
let matchesLeft = tournament.matchesLeft(allMatches)
let runningMatches = tournament.runningMatches(allMatches)
let readyMatches = tournament.readyMatches(allMatches)
let availableToStart = tournament.availableToStart(readyMatches, in: runningMatches, checkCanPlay: false)
// if tournament.hasEnded() == false {
// NavigationLink {
// TeamRestingView(readyMatches: availableToStart, matchesLeft: matchesLeft)
// .environment(tournament)
// } label: {
// Text("Temps de repos")
// }
// }
MatchListView(section: "à venir", matches: readyMatches, hideWhenEmpty: true, isExpanded: false)

@ -111,6 +111,8 @@ struct TournamentView: View {
}
case .print:
PrintSettingsView(tournament: tournament)
case .restingTime:
TeamRestingView()
}
}
.environment(tournament)

Loading…
Cancel
Save