add tips and guide

multistore
Razmig Sarkissian 1 year ago
parent 15bb8f879a
commit 9dc16f9c81
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 4
      PadelClub/Data/Tournament.swift
  3. 27
      PadelClub/Utils/Tips.swift
  4. 1
      PadelClub/Utils/URLs.swift
  5. 4
      PadelClub/Views/Navigation/Toolbox/ToolboxView.swift
  6. 75
      PadelClub/Views/Tournament/TournamentBuildView.swift
  7. 54
      PadelClub/Views/Tournament/TournamentRunningView.swift
  8. 15
      PadelClub/Views/Tournament/TournamentView.swift

@ -126,6 +126,7 @@
FF1DC5592BAB767000FD8220 /* Tips.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF1DC5582BAB767000FD8220 /* Tips.swift */; };
FF1DC55B2BAB80C400FD8220 /* DisplayContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF1DC55A2BAB80C400FD8220 /* DisplayContext.swift */; };
FF1DF49B2BD8D23900822FA0 /* BarButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF1DF49A2BD8D23900822FA0 /* BarButtonView.swift */; };
FF1F4B6D2BF9E60B000B4573 /* TournamentBuildView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF1F4B6C2BF9E60B000B4573 /* TournamentBuildView.swift */; };
FF2EFBF02BDE295E0049CE3B /* SendToAllView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF2EFBEF2BDE295E0049CE3B /* SendToAllView.swift */; };
FF3795622B9396D0004EA093 /* PadelClubApp.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = FF3795602B9396D0004EA093 /* PadelClubApp.xcdatamodeld */; };
FF3795662B9399AA004EA093 /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3795652B9399AA004EA093 /* Persistence.swift */; };
@ -428,6 +429,7 @@
FF1DC5582BAB767000FD8220 /* Tips.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tips.swift; sourceTree = "<group>"; };
FF1DC55A2BAB80C400FD8220 /* DisplayContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayContext.swift; sourceTree = "<group>"; };
FF1DF49A2BD8D23900822FA0 /* BarButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarButtonView.swift; sourceTree = "<group>"; };
FF1F4B6C2BF9E60B000B4573 /* TournamentBuildView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TournamentBuildView.swift; sourceTree = "<group>"; };
FF2EFBEF2BDE295E0049CE3B /* SendToAllView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendToAllView.swift; sourceTree = "<group>"; };
FF3795612B9396D0004EA093 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
FF3795652B9399AA004EA093 /* Persistence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; };
@ -918,6 +920,7 @@
children = (
FF70916B2B91005400AB08DA /* TournamentView.swift */,
FF8F26402BADFC8700650388 /* TournamentInitView.swift */,
FF1F4B6C2BF9E60B000B4573 /* TournamentBuildView.swift */,
FF967CF52BAED51600A9A3BD /* TournamentRunningView.swift */,
FF089EBE2BB0B14600F0AEC7 /* FileImportView.swift */,
FF3F74F92B91A018004CFE0E /* Screen */,
@ -1600,6 +1603,7 @@
FFCFC01A2BBC5A8500B82851 /* MatchTypeSmallSelectionView.swift in Sources */,
FF025AE92BD1307F00A86CF8 /* MonthData.swift in Sources */,
FFEF7F4E2BDE69130033D0F0 /* MenuWarningView.swift in Sources */,
FF1F4B6D2BF9E60B000B4573 /* TournamentBuildView.swift in Sources */,
FF967D0B2BAF3D4C00A9A3BD /* TeamPickerView.swift in Sources */,
FFA6D7872BB0B7A2003A31F3 /* CloudConvert.swift in Sources */,
FFBF41842BF75ED7001B24CB /* EventTournamentsView.swift in Sources */,

@ -290,6 +290,7 @@ class Tournament : ModelObject, Storable {
enum State {
case initial
case build
case running
case canceled
}
@ -400,6 +401,9 @@ class Tournament : ModelObject, Storable {
if self.isCanceled == true {
return .canceled
}
if startDate >= Date() { return .running }
if (groupStageCount > 0 && groupStages().isEmpty == false)
|| rounds().isEmpty == false {
return .build

@ -385,6 +385,33 @@ struct TournamentSelectionTip: Tip {
}
}
struct TournamentRunningTip: Tip {
@Parameter
static var isRunning: Bool = false
var rules: [Rule] {
[
// Define a rule based on the app state.
#Rule(Self.$isRunning) {
// Set the conditions for when the tip displays.
return $0
}
]
}
var title: Text {
Text("Tournoi en cours")
}
var message: Text? {
return Text("Le tournoi a commencé, les options utiles à sa préparation son accessible ici pour laisser la place aux matchs.")
}
var image: Image? {
Image(systemName: "ellipsis.circle.fill")
}
}
struct TipStyleModifier: ViewModifier {
@Environment(\.colorScheme) var colorScheme
var tint: Color?

@ -12,6 +12,7 @@ enum URLs: String, Identifiable {
case main = "https://xlr.alwaysdata.net/"
case beachPadel = "https://beach-padel.app.fft.fr/beachja/index/"
//case padelClub = "https://padelclub.app"
case padelRules = "https://fft-site.cdn.prismic.io/fft-site/ZgLn3McYqOFdyF7n_LEGUIDEDELACOMPETITIONDEPADEL-MAJDECEMBRE2023.pdf"
var id: String { return self.rawValue }

@ -44,6 +44,10 @@ struct ToolboxView: View {
} footer: {
Text("Vous pouvez définir vos propres estimations de durées de match en fonction du format de jeu.")
}
Section {
Link("Guide de la compétition", destination: URLs.padelRules)
}
}
.navigationTitle(TabDestination.toolbox.title)
}

@ -0,0 +1,75 @@
//
// TournamentBuildView.swift
// PadelClub
//
// Created by Razmig Sarkissian on 19/05/2024.
//
import SwiftUI
struct TournamentBuildView: View {
var tournament: Tournament
@ViewBuilder
var body: some View {
TournamentInitView(tournament: tournament)
Section {
NavigationLink(value: Screen.schedule) {
let tournamentStatus = tournament.scheduleStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Horaires")
Text(tournamentStatus.label)
}
}
NavigationLink(value: Screen.call) {
let tournamentStatus = tournament.callStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Convocations")
Text(tournamentStatus.label)
}
}
NavigationLink(value: Screen.cashier) {
let tournamentStatus = tournament.cashierStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Encaissement")
Text(tournamentStatus.label)
}
}
}
Section {
if tournament.groupStages().isEmpty == false {
NavigationLink(value: Screen.groupStage) {
LabeledContent {
Text(tournament.groupStageStatus())
} label: {
Text("Poules")
}
}
}
if tournament.rounds().isEmpty == false {
NavigationLink(value: Screen.round) {
LabeledContent {
Text(tournament.bracketStatus())
} label: {
Text("Tableau")
}
}
}
}
}
}
#Preview {
TournamentBuildView(tournament: Tournament.mock())
}

@ -18,59 +18,7 @@ struct TournamentRunningView: View {
@ViewBuilder
var body: some View {
Section {
NavigationLink(value: Screen.schedule) {
let tournamentStatus = tournament.scheduleStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Horaires")
Text(tournamentStatus.label)
}
}
NavigationLink(value: Screen.call) {
let tournamentStatus = tournament.callStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Convocations")
Text(tournamentStatus.label)
}
}
NavigationLink(value: Screen.cashier) {
let tournamentStatus = tournament.cashierStatus()
LabeledContent {
Text(tournamentStatus.completion)
} label: {
Text("Encaissement")
Text(tournamentStatus.label)
}
}
}
Section {
if tournament.groupStages().isEmpty == false {
NavigationLink(value: Screen.groupStage) {
LabeledContent {
Text(tournament.groupStageStatus())
} label: {
Text("Poules")
}
}
}
if tournament.rounds().isEmpty == false {
NavigationLink(value: Screen.round) {
LabeledContent {
Text(tournament.bracketStatus())
} label: {
Text("Tableau")
}
}
}
}
TournamentBuildView(tournament: tournament)
MatchListView(section: "en cours", matches: tournament.runningMatches(allMatches))
MatchListView(section: "à lancer", matches: tournament.readyMatches(allMatches), isExpanded: false)

@ -16,6 +16,7 @@ struct TournamentView: View {
var presentationContext: PresentationContext = .agenda
let tournamentSelectionTip = TournamentSelectionTip()
let tournamentRunningTip = TournamentRunningTip()
var selectedTournamentId: Binding<String> { Binding(
get: { tournament.id },
@ -86,6 +87,8 @@ struct TournamentView: View {
case .initial:
TournamentInitView(tournament: tournament)
case .build:
TournamentBuildView(tournament: tournament)
case .running:
TournamentRunningView(tournament: tournament)
if tournament.hasEnded() {
@ -155,7 +158,7 @@ struct TournamentView: View {
}
}
if presentationContext == .agenda || tournament.state() == .build {
if presentationContext == .agenda || tournament.state() == .running {
ToolbarItem(placement: .topBarTrailing) {
Menu {
if presentationContext == .agenda {
@ -167,7 +170,7 @@ struct TournamentView: View {
}
Divider()
if tournament.state() == .build {
if tournament.state() == .running {
NavigationLink(value: Screen.event) {
Text("Gestion de l'événement")
}
@ -178,9 +181,7 @@ struct TournamentView: View {
NavigationLink(value: Screen.structure) {
LabelStructure()
}
NavigationLink(value: Screen.rankings) {
Text("Classement")
}
NavigationLink(value: Screen.broadcast) {
Text("Publication")
}
@ -188,6 +189,10 @@ struct TournamentView: View {
} label: {
LabelOptions()
}
.popoverTip(tournamentRunningTip)
.onAppear {
TournamentRunningTip.isRunning = tournament.state == .running
}
}
}
}

Loading…
Cancel
Save