fix broadcast sections

multistore
Razmig Sarkissian 1 year ago
parent d4dc4422ca
commit 31ef90c4dd
  1. 4
      PadelClub.xcodeproj/project.pbxproj
  2. 2
      PadelClub/Utils/URLs.swift
  3. 4
      PadelClub/Views/Calling/SendToAllView.swift
  4. 404
      PadelClub/Views/Tournament/Screen/BroadcastView.swift

@ -1882,7 +1882,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 74; CURRENT_PROJECT_VERSION = 75;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -1922,7 +1922,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 74; CURRENT_PROJECT_VERSION = 75;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;

@ -28,7 +28,7 @@ enum PageLink: String, Identifiable, CaseIterable {
case teams = "Équipes" case teams = "Équipes"
case summons = "Convocations" case summons = "Convocations"
case groupStages = "Poules" case groupStages = "Poules"
case matches = "Matchs" case matches = "Tournoi"
case rankings = "Classement" case rankings = "Classement"
case broadcast = "Mode TV (Tournoi)" case broadcast = "Mode TV (Tournoi)"
case clubBroadcast = "Mode TV (Club)" case clubBroadcast = "Mode TV (Club)"

@ -84,10 +84,10 @@ struct SendToAllView: View {
let links : [PageLink] = [.teams, .summons, .groupStages, .matches, .rankings] let links : [PageLink] = [.teams, .summons, .groupStages, .matches, .rankings]
Picker(selection: $pageLink) { Picker(selection: $pageLink) {
ForEach(links) { pageLink in ForEach(links) { pageLink in
Text(pageLink.localizedLabel()) Text(pageLink.localizedLabel()).tag(pageLink)
} }
} label: { } label: {
Text("Choisir une page du tournoi en particulier") Text("Lien à partager")
} }
.pickerStyle(.menu) .pickerStyle(.menu)
} }

@ -34,264 +34,245 @@ struct BroadcastView: View {
List { List {
if Store.main.userId == nil { if Store.main.userId == nil {
Section { Section {
TipView(createAccountTip) { action in ContentUnavailableView {
switch action.id { Label("Créer votre compte Padel Club", systemImage: "person.bust")
case CreateAccountTip.ActionKey.accessPadelClubWebPage.rawValue:
UIApplication.shared.open(URLs.main.url)
case CreateAccountTip.ActionKey.createAccount.rawValue:
navigation.selectedTab = .umpire
default:
break
//todo
// case CreateAccountTip.ActionKey.learnMore.rawValue:
// UIApplication.shared.open(URLs.padelClubLandingPage.url)
}
}
.tipStyle(tint: .master)
}
}
Section { } description: {
TipView(tournamentPublishingTip) { action in let message = "Un compte est nécessaire pour publier le tournoi sur [Padel Club](\(URLs.main.rawValue)) et profiter de toutes les pages du site, comme le mode TV pour transformer l'expérience de vos tournois !"
UIApplication.shared.open(URLs.main.url) Text(.init(message))
}
.tipStyle(tint: nil)
}
Section {
TipView(tournamentTVBroadcastTip)
.tipStyle(tint: nil)
}
if tournament.isPrivate == false { } actions: {
if let url = tournament.shareURL(.clubBroadcast) { RowButtonView("Créer votre compte") {
Section { navigation.selectedTab = .umpire
Link(destination: url) {
Text(url.absoluteString)
} }
.contextMenu {
Button("Copier") { RowButtonView("Jeter un oeil au site Padel Club") {
let pasteboard = UIPasteboard.general UIApplication.shared.open(URLs.main.url)
pasteboard.string = url.absoluteString
}
} }
} header: {
Text("Lien pour la diffusion TV")
} footer: {
Text("Lien à mettre sur une smart tv ou ordinateur dans le club house par exemple !")
} }
} }
} else {
Section {
TipView(tournamentPublishingTip) { action in
UIApplication.shared.open(URLs.main.url)
}
.tipStyle(tint: nil)
}
Section { Section {
LabeledContent { let links : [PageLink] = [.teams, .summons, .groupStages, .matches, .rankings, .broadcast, .clubBroadcast]
if tournament.isTournamentPublished() { Picker(selection: $pageLink) {
Image(systemName:"checkmark").foregroundStyle(.green) ForEach(links) { pageLink in
} else { Text(pageLink.localizedLabel()).tag(pageLink)
Text(tournament.publishedTournamentDate().formatted())
} }
} label: { } label: {
if tournament.isTournamentPublished() { Text("Choisir la page à partager")
Text("Publiée")
} else {
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.")
} }
.pickerStyle(.menu)
actionForURL(title: "Partager la page '" + pageLink.localizedLabel() + "'", url: tournament.shareURL(pageLink))
} header: { } header: {
Text("Information sur le tournoi") Text("Lien du tournoi à partager")
} footer: {
if Date() < tournament.publishedTournamentDate() || tournament.canBePublished() == false {
HStack {
Spacer()
FooterButtonView(tournament.publishTournament ? "masquer sur le site" : "publier maintenant") {
tournament.publishTournament.toggle()
_save()
}
}
}
} }
Section { Section {
LabeledContent { let club = tournament.club()
if tournament.areTeamsPublished() { actionForURL(title: (club == nil) ? "Aucun club indiqué pour ce tournoi" : club!.clubTitle(), description: "Page du club", url: club?.shareURL())
Image(systemName:"checkmark").foregroundStyle(.green) actionForURL(title: "Padel Club", url: URLs.main.url)
} else { } header: {
Text(tournament.publishedTeamsDate().formatted()) Text("Autres liens")
} }
} label: {
if tournament.areTeamsPublished() {
Text("Publiée")
} else {
Text("Publication prévue")
}
}
Toggle(isOn: $tournament.hideTeamsWeight) { if tournament.isPrivate == false {
Text("Masquer les poids des équipes") Section {
TipView(tournamentTVBroadcastTip)
.tipStyle(tint: nil)
} }
} header: {
Text("Liste des équipes") if let url = tournament.shareURL(.clubBroadcast) {
} footer: { Section {
if Date() < tournament.publishedTeamsDate() { Link(destination: url) {
HStack { Text(url.absoluteString)
Spacer() }
FooterButtonView(tournament.publishTeams ? "masquer sur le site" : "publier maintenant") { .contextMenu {
tournament.publishTeams.toggle() Button("Copier") {
_save() let pasteboard = UIPasteboard.general
pasteboard.string = url.absoluteString
}
} }
} header: {
Text("Lien pour la diffusion TV")
} footer: {
Text("Lien à mettre sur une smart tv ou ordinateur dans le club house par exemple !")
} }
} }
}
Section {
LabeledContent { Section {
if tournament.areSummonsPublished() { LabeledContent {
Image(systemName:"checkmark").foregroundStyle(.green) if tournament.isTournamentPublished() {
} else { Image(systemName:"checkmark").foregroundStyle(.green)
Text(tournament.publishedTeamsDate().formatted()) } else {
Text(tournament.publishedTournamentDate().formatted())
}
} label: {
if tournament.isTournamentPublished() {
Text("Publiée")
} else {
Text("Publication prévue")
}
} }
} label: {
if tournament.areSummonsPublished() { if tournament.canBePublished() == false {
Text("Publiées") Text("Pour être visible automatiquement, le tournoi doit avoir été créé il y a 24h, avoir une structure et au moins 4 inscriptions.")
} else {
Text("Publication prévue")
} }
} } header: {
} header: { Text("Information sur le tournoi")
Text("Convocations") } footer: {
} footer: { if Date() < tournament.publishedTournamentDate() || tournament.canBePublished() == false {
if Date() < tournament.publishedTeamsDate() { HStack {
HStack { Spacer()
Spacer() FooterButtonView(tournament.publishTournament ? "masquer sur le site" : "publier maintenant") {
FooterButtonView(tournament.publishSummons ? "masquer sur le site" : "publier maintenant") { tournament.publishTournament.toggle()
tournament.publishSummons.toggle() _save()
_save() }
} }
} }
} }
}
if let publishedGroupStagesDate = tournament.publishedGroupStagesDate() {
Section { Section {
let areGroupStagesPublished = tournament.areGroupStagesPublished()
LabeledContent { LabeledContent {
if areGroupStagesPublished { if tournament.areTeamsPublished() {
Image(systemName:"checkmark").foregroundStyle(.green) Image(systemName:"checkmark").foregroundStyle(.green)
} else { } else {
Text(publishedGroupStagesDate.formatted()) Text(tournament.publishedTeamsDate().formatted())
} }
} label: { } label: {
if areGroupStagesPublished { if tournament.areTeamsPublished() {
Text("Publiées") Text("Publiée")
} else { } else {
Text("Publication prévue") Text("Publication prévue")
} }
} }
Toggle(isOn: $tournament.hideTeamsWeight) {
Text("Masquer les poids des équipes")
}
} header: { } header: {
Text("Poules") Text("Liste des équipes")
} footer: { } footer: {
if Date() < publishedGroupStagesDate { if Date() < tournament.publishedTeamsDate() {
HStack { HStack {
Spacer() Spacer()
FooterButtonView(tournament.publishGroupStages ? "masquer sur le site" : "publier maintenant") { FooterButtonView(tournament.publishTeams ? "masquer sur le site" : "publier maintenant") {
tournament.publishGroupStages.toggle() tournament.publishTeams.toggle()
_save() _save()
} }
} }
} }
} }
}
if let publishedBracketsDate = tournament.publishedBracketsDate() {
Section { Section {
let areBracketsPublished = tournament.areBracketsPublished()
LabeledContent { LabeledContent {
if areBracketsPublished { if tournament.areSummonsPublished() {
Image(systemName:"checkmark").foregroundStyle(.green) Image(systemName:"checkmark").foregroundStyle(.green)
} else { } else {
Text(publishedBracketsDate.formatted()) Text(tournament.publishedTeamsDate().formatted())
} }
} label: { } label: {
if areBracketsPublished { if tournament.areSummonsPublished() {
Text("Publié") Text("Publiées")
} else { } else {
Text("Publication prévue") Text("Publication prévue")
} }
} }
} header: { } header: {
Text("Tableau") Text("Convocations")
} footer: { } footer: {
if Date() < publishedBracketsDate { if Date() < tournament.publishedTeamsDate() {
HStack { HStack {
Spacer() Spacer()
FooterButtonView(tournament.publishBrackets ? "masquer sur le site" : "publier maintenant") { FooterButtonView(tournament.publishSummons ? "masquer sur le site" : "publier maintenant") {
tournament.publishBrackets.toggle() tournament.publishSummons.toggle()
_save() _save()
} }
} }
} }
} }
}
}
//todo waitinglist & info
Section {
Toggle(isOn: $tournament.isPrivate) {
Text("Tournoi privé")
}
} footer: {
let footerString = "Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))"
Text(.init(footerString))
}
Section {
LabeledContent {
actionForURL(URLs.main.url)
} label: {
Text("Padel Club")
}
let club = tournament.club() if let publishedGroupStagesDate = tournament.publishedGroupStagesDate() {
LabeledContent { Section {
if let clubURL = club?.shareURL() { let areGroupStagesPublished = tournament.areGroupStagesPublished()
actionForURL(clubURL) LabeledContent {
} if areGroupStagesPublished {
} label: { Image(systemName:"checkmark").foregroundStyle(.green)
Text("Club") } else {
if let club { Text(publishedGroupStagesDate.formatted())
Text(club.clubTitle()) }
} else { } label: {
Text("Aucun club indiqué pour ce tournoi") if areGroupStagesPublished {
Text("Publiées")
} else {
Text("Publication prévue")
}
}
} header: {
Text("Poules")
} footer: {
if Date() < publishedGroupStagesDate {
HStack {
Spacer()
FooterButtonView(tournament.publishGroupStages ? "masquer sur le site" : "publier maintenant") {
tournament.publishGroupStages.toggle()
_save()
}
}
}
}
} }
}
if let url = tournament.shareURL(pageLink) { if let publishedBracketsDate = tournament.publishedBracketsDate() {
LabeledContent { Section {
actionForURL(url) let areBracketsPublished = tournament.areBracketsPublished()
} label: { LabeledContent {
Text("Tournoi") if areBracketsPublished {
Text(pageLink.localizedLabel()) Image(systemName:"checkmark").foregroundStyle(.green)
} else {
Text(publishedBracketsDate.formatted())
}
} label: {
if areBracketsPublished {
Text("Publié")
} else {
Text("Publication prévue")
}
}
} header: {
Text("Tableau")
} footer: {
if Date() < publishedBracketsDate {
HStack {
Spacer()
FooterButtonView(tournament.publishBrackets ? "masquer sur le site" : "publier maintenant") {
tournament.publishBrackets.toggle()
_save()
}
}
}
}
} }
} }
let links : [PageLink] = [.teams, .summons, .groupStages, .matches, .rankings, .broadcast, .clubBroadcast] //todo waitinglist & info
Picker(selection: $pageLink) {
ForEach(links) { pageLink in Section {
Text(pageLink.localizedLabel()).tag(pageLink) Toggle(isOn: $tournament.isPrivate) {
Text("Tournoi privé")
} }
} label: { } footer: {
Text("Modifier la page du tournoi à partager") let footerString = "Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))"
Text(.init(footerString))
} }
.pickerStyle(.menu)
} header: {
Text("Liens à partager")
.textCase(nil)
} }
} }
.headerProminence(.increased) .headerProminence(.increased)
.navigationTitle("Publication") .navigationTitle("Publication")
@ -343,31 +324,48 @@ struct BroadcastView: View {
} }
@ViewBuilder @ViewBuilder
func actionForURL(_ url: URL, removeSource: Bool = false) -> some View { func actionForURL(title: String, description: String? = nil, url: URL?, removeSource: Bool = false) -> some View {
Menu { if let url {
Button { Menu {
UIApplication.shared.open(url) Button {
} label: { UIApplication.shared.open(url)
Label("Voir", systemImage: "safari") } label: {
} Label("Voir", systemImage: "safari")
}
Button { Button {
urlToShow = url.absoluteString urlToShow = url.absoluteString
} label: { } label: {
Label("QRCode", systemImage: "qrcode") Label("QRCode", systemImage: "qrcode")
} }
ShareLink(item: url) { ShareLink(item: url) {
Label("Partager le lien", systemImage: "link") Label("Partager le lien", systemImage: "link")
}
} label: {
LabeledContent {
Image(systemName: "square.and.arrow.up")
.foregroundColor(.master)
} label: {
Text(title)
.foregroundColor(.primary)
if let description {
Text(description)
.foregroundColor(.secondary)
}
}
} }
} label: { .buttonStyle(.plain)
HStack { } else {
Spacer() LabeledContent {
Image(systemName: "square.and.arrow.up") Image(systemName: "xmark").foregroundColor(.logoYellow)
} label: {
Text(title)
if let description {
Text(description)
}
} }
} }
.frame(maxWidth: .infinity)
.buttonStyle(.borderless)
} }

Loading…
Cancel
Save