From badd580de71ac268f35066d7f48979b035412135 Mon Sep 17 00:00:00 2001 From: Raz Date: Thu, 12 Sep 2024 11:46:12 +0200 Subject: [PATCH] update de la vue publication --- PadelClub/Data/Tournament.swift | 2 +- .../Tournament/Screen/BroadcastView.swift | 60 ++++++++++--------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/PadelClub/Data/Tournament.swift b/PadelClub/Data/Tournament.swift index 35c94eb..e042f11 100644 --- a/PadelClub/Data/Tournament.swift +++ b/PadelClub/Data/Tournament.swift @@ -439,7 +439,7 @@ final class Tournament : ModelObject, Storable { } func isTournamentPublished() -> Bool { - return (Date() >= publishedTournamentDate() && canBePublished()) || publishTournament + return (Date() >= publishedTournamentDate()) || publishTournament } func areTeamsPublished() -> Bool { diff --git a/PadelClub/Views/Tournament/Screen/BroadcastView.swift b/PadelClub/Views/Tournament/Screen/BroadcastView.swift index 23fc7fe..661f69e 100644 --- a/PadelClub/Views/Tournament/Screen/BroadcastView.swift +++ b/PadelClub/Views/Tournament/Screen/BroadcastView.swift @@ -118,30 +118,6 @@ struct BroadcastView: View { if tournament.isPrivate == false { - Section { - let links : [PageLink] = [.teams, .summons, .groupStages, .matches, .rankings, .broadcast, .clubBroadcast] - Picker(selection: $pageLink) { - ForEach(links) { pageLink in - Text(pageLink.localizedLabel()).tag(pageLink) - } - } label: { - Text("Choisir la page à partager") - } - .pickerStyle(.menu) - actionForURL(title: "Partager la page '" + pageLink.localizedLabel() + "'", url: tournament.shareURL(pageLink)) - } header: { - Text("Lien du tournoi à partager") - } - - Section { - let club = tournament.club() - actionForURL(title: (club == nil) ? "Aucun club indiqué pour ce tournoi" : club!.clubTitle(), description: "Page du club", url: club?.shareURL()) - actionForURL(title: "Padel Club", url: URLs.main.url) - } header: { - Text("Autres liens") - } - - Section { LabeledContent { if tournament.isTournamentPublished() { @@ -156,14 +132,10 @@ struct BroadcastView: View { Text("Publication prévue") } } - - if tournament.canBePublished() == false { - Text("Pour être visible automatiquement, le tournoi doit avoir été créé il y a 24h, avoir une structure et au moins 4 inscriptions.") - } } header: { Text("Information sur le tournoi") } footer: { - if Date() < tournament.publishedTournamentDate() || tournament.canBePublished() == false { + if Date() < tournament.publishedTournamentDate() || tournament.isTournamentPublished() == false { HStack { Spacer() FooterButtonView(tournament.publishTournament ? "masquer sur le site" : "publier maintenant") { @@ -300,6 +272,36 @@ struct BroadcastView: View { //todo waitinglist & info } } + .toolbar(content: { + ToolbarItem(placement: .topBarTrailing) { + Menu { + Section { + let links : [PageLink] = [.teams, .summons, .groupStages, .matches, .rankings, .broadcast, .clubBroadcast] + Picker(selection: $pageLink) { + ForEach(links) { pageLink in + Text(pageLink.localizedLabel()).tag(pageLink) + } + } label: { + Text("Choisir la page à partager") + } + .pickerStyle(.menu) + actionForURL(title: "Partager la page '" + pageLink.localizedLabel() + "'", url: tournament.shareURL(pageLink)) + } header: { + Text("Lien du tournoi à partager") + } + + Section { + let club = tournament.club() + actionForURL(title: (club == nil) ? "Aucun club indiqué pour ce tournoi" : club!.clubTitle(), description: "Page du club", url: club?.shareURL()) + actionForURL(title: "Padel Club", url: URLs.main.url) + } header: { + Text("Autres liens") + } + } label: { + Label("Partager les liens", systemImage: "square.and.arrow.up") + } + } + }) .headerProminence(.increased) .navigationTitle("Publication") .navigationBarTitleDisplayMode(.inline)