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. 122
      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,35 +34,60 @@ 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) } description: {
case CreateAccountTip.ActionKey.createAccount.rawValue: 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 !"
Text(.init(message))
} actions: {
RowButtonView("Créer votre compte") {
navigation.selectedTab = .umpire navigation.selectedTab = .umpire
default:
break
//todo
// case CreateAccountTip.ActionKey.learnMore.rawValue:
// UIApplication.shared.open(URLs.padelClubLandingPage.url)
} }
RowButtonView("Jeter un oeil au site Padel Club") {
UIApplication.shared.open(URLs.main.url)
} }
.tipStyle(tint: .master)
} }
} }
} else {
Section { Section {
TipView(tournamentPublishingTip) { action in TipView(tournamentPublishingTip) { action in
UIApplication.shared.open(URLs.main.url) UIApplication.shared.open(URLs.main.url)
} }
.tipStyle(tint: nil) .tipStyle(tint: nil)
} }
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")
}
if tournament.isPrivate == false {
Section { Section {
TipView(tournamentTVBroadcastTip) TipView(tournamentTVBroadcastTip)
.tipStyle(tint: nil) .tipStyle(tint: nil)
} }
if tournament.isPrivate == false {
if let url = tournament.shareURL(.clubBroadcast) { if let url = tournament.shareURL(.clubBroadcast) {
Section { Section {
Link(destination: url) { Link(destination: url) {
@ -247,51 +272,7 @@ struct BroadcastView: View {
let footerString = "Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))" let footerString = "Le tournoi sera masqué sur le site [Padel Club](\(URLs.main.rawValue))"
Text(.init(footerString)) Text(.init(footerString))
} }
Section {
LabeledContent {
actionForURL(URLs.main.url)
} label: {
Text("Padel Club")
} }
let club = tournament.club()
LabeledContent {
if let clubURL = club?.shareURL() {
actionForURL(clubURL)
}
} label: {
Text("Club")
if let club {
Text(club.clubTitle())
} else {
Text("Aucun club indiqué pour ce tournoi")
}
}
if let url = tournament.shareURL(pageLink) {
LabeledContent {
actionForURL(url)
} label: {
Text("Tournoi")
Text(pageLink.localizedLabel())
}
}
let links : [PageLink] = [.teams, .summons, .groupStages, .matches, .rankings, .broadcast, .clubBroadcast]
Picker(selection: $pageLink) {
ForEach(links) { pageLink in
Text(pageLink.localizedLabel()).tag(pageLink)
}
} label: {
Text("Modifier la page du tournoi à partager")
}
.pickerStyle(.menu)
} header: {
Text("Liens à partager")
.textCase(nil)
}
} }
.headerProminence(.increased) .headerProminence(.increased)
.navigationTitle("Publication") .navigationTitle("Publication")
@ -343,7 +324,8 @@ 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 {
if let url {
Menu { Menu {
Button { Button {
UIApplication.shared.open(url) UIApplication.shared.open(url)
@ -361,13 +343,29 @@ struct BroadcastView: View {
Label("Partager le lien", systemImage: "link") Label("Partager le lien", systemImage: "link")
} }
} label: { } label: {
HStack { LabeledContent {
Spacer()
Image(systemName: "square.and.arrow.up") Image(systemName: "square.and.arrow.up")
.foregroundColor(.master)
} label: {
Text(title)
.foregroundColor(.primary)
if let description {
Text(description)
.foregroundColor(.secondary)
}
}
}
.buttonStyle(.plain)
} else {
LabeledContent {
Image(systemName: "xmark").foregroundColor(.logoYellow)
} label: {
Text(title)
if let description {
Text(description)
}
} }
} }
.frame(maxWidth: .infinity)
.buttonStyle(.borderless)
} }

Loading…
Cancel
Save