update de la vue publication

sync2
Raz 1 year ago
parent 5469ce290c
commit badd580de7
  1. 2
      PadelClub/Data/Tournament.swift
  2. 60
      PadelClub/Views/Tournament/Screen/BroadcastView.swift

@ -439,7 +439,7 @@ final class Tournament : ModelObject, Storable {
} }
func isTournamentPublished() -> Bool { func isTournamentPublished() -> Bool {
return (Date() >= publishedTournamentDate() && canBePublished()) || publishTournament return (Date() >= publishedTournamentDate()) || publishTournament
} }
func areTeamsPublished() -> Bool { func areTeamsPublished() -> Bool {

@ -118,30 +118,6 @@ struct BroadcastView: View {
if tournament.isPrivate == false { 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 { Section {
LabeledContent { LabeledContent {
if tournament.isTournamentPublished() { if tournament.isTournamentPublished() {
@ -156,14 +132,10 @@ struct BroadcastView: View {
Text("Publication prévue") 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: { } header: {
Text("Information sur le tournoi") Text("Information sur le tournoi")
} footer: { } footer: {
if Date() < tournament.publishedTournamentDate() || tournament.canBePublished() == false { if Date() < tournament.publishedTournamentDate() || tournament.isTournamentPublished() == false {
HStack { HStack {
Spacer() Spacer()
FooterButtonView(tournament.publishTournament ? "masquer sur le site" : "publier maintenant") { FooterButtonView(tournament.publishTournament ? "masquer sur le site" : "publier maintenant") {
@ -300,6 +272,36 @@ struct BroadcastView: View {
//todo waitinglist & info //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) .headerProminence(.increased)
.navigationTitle("Publication") .navigationTitle("Publication")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)

Loading…
Cancel
Save