You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.1 KiB
31 lines
1.1 KiB
//
|
|
// TournamentRunningView.swift
|
|
// PadelClub
|
|
//
|
|
// Created by Razmig Sarkissian on 23/03/2024.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct TournamentRunningView: View {
|
|
var tournament: Tournament
|
|
var allMatches: [Match]
|
|
|
|
init(tournament: Tournament) {
|
|
self.tournament = tournament
|
|
self.allMatches = tournament.allMatches()
|
|
}
|
|
|
|
@ViewBuilder
|
|
var body: some View {
|
|
MatchListView(section: "en cours", matches: tournament.runningMatches(allMatches), hideWhenEmpty: tournament.hasEnded())
|
|
// MatchListView(section: "à lancer", matches: tournament.readyMatches(allMatches), isExpanded: false)
|
|
// MatchListView(section: "disponible", matches: tournament.availableToStart(allMatches), isExpanded: false)
|
|
let finishedMatches = tournament.finishedMatches(allMatches, limit: tournament.courtCount)
|
|
MatchListView(section: "Dernier\(finishedMatches.count.pluralSuffix) match\(finishedMatches.count.pluralSuffix) terminé\(finishedMatches.count.pluralSuffix)", matches: finishedMatches, isExpanded: tournament.hasEnded())
|
|
}
|
|
}
|
|
|
|
//#Preview {
|
|
// TournamentRunningView(tournament: Tournament.mock())
|
|
//}
|
|
|