|
|
|
|
@ -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,7 +63,6 @@ struct TeamRestingView: View { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
NavigationStack { |
|
|
|
|
List { |
|
|
|
|
Section { |
|
|
|
|
Picker(selection: $selectedCourt) { |
|
|
|
|
@ -110,7 +107,6 @@ struct TeamRestingView: View { |
|
|
|
|
} |
|
|
|
|
.labelsHidden() |
|
|
|
|
.pickerStyle(.segmented) |
|
|
|
|
.fixedSize() |
|
|
|
|
} |
|
|
|
|
.headerProminence(.increased) |
|
|
|
|
.textCase(nil) |
|
|
|
|
@ -118,6 +114,13 @@ struct TeamRestingView: View { |
|
|
|
|
.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 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|