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. 17
      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_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7; CURRENT_PROJECT_VERSION = 8;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3219,7 +3219,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7; CURRENT_PROJECT_VERSION = 8;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;

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

@ -8,13 +8,11 @@
import SwiftUI import SwiftUI
struct TeamRestingView: View { struct TeamRestingView: View {
@Environment(Tournament.self) var tournament @Environment(Tournament.self) var tournament: Tournament
let readyMatches: [Match]
let matchesLeft: [Match]
@State private var sortingMode: SortingMode = .restingTime @State private var sortingMode: SortingMode = .restingTime
@State private var selectedCourt: Int? @State private var selectedCourt: Int?
@State private var readyMatches: [Match] = []
@State private var matchesLeft: [Match] = []
enum SortingMode: Int, Identifiable, CaseIterable { enum SortingMode: Int, Identifiable, CaseIterable {
var id: Int { self.rawValue } var id: Int { self.rawValue }
@ -65,7 +63,6 @@ struct TeamRestingView: View {
} }
var body: some View { var body: some View {
NavigationStack {
List { List {
Section { Section {
Picker(selection: $selectedCourt) { Picker(selection: $selectedCourt) {
@ -110,7 +107,6 @@ struct TeamRestingView: View {
} }
.labelsHidden() .labelsHidden()
.pickerStyle(.segmented) .pickerStyle(.segmented)
.fixedSize()
} }
.headerProminence(.increased) .headerProminence(.increased)
.textCase(nil) .textCase(nil)
@ -118,6 +114,13 @@ struct TeamRestingView: View {
.toolbarBackground(.visible, for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar)
.navigationTitle("Match à suivre") .navigationTitle("Match à suivre")
.navigationBarTitleDisplayMode(.inline) .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 { if state == .running || state == .finished {
TournamentInscriptionView(tournament: tournament) TournamentInscriptionView(tournament: tournament)

@ -19,19 +19,8 @@ struct TournamentRunningView: View {
@ViewBuilder @ViewBuilder
var body: some View { var body: some View {
let matchesLeft = tournament.matchesLeft(allMatches)
let runningMatches = tournament.runningMatches(allMatches) let runningMatches = tournament.runningMatches(allMatches)
let readyMatches = tournament.readyMatches(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) MatchListView(section: "à venir", matches: readyMatches, hideWhenEmpty: true, isExpanded: false)

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

Loading…
Cancel
Save