diff --git a/PadelClub/Views/Cashier/Event/EventSettingsView.swift b/PadelClub/Views/Cashier/Event/EventSettingsView.swift index 9d24df8..d0e8024 100644 --- a/PadelClub/Views/Cashier/Event/EventSettingsView.swift +++ b/PadelClub/Views/Cashier/Event/EventSettingsView.swift @@ -23,6 +23,20 @@ struct EventSettingsView: View { var link = [String]() link.append(event.eventTitle()) + link.append("\n\n") + + link.append(tournamentInformation) + + link.append("\n\n") + + if let url = event.shareURL() { + var tournamentLink = [String]() + tournamentLink.append("Lien de l'événement") + tournamentLink.append(url.absoluteString) + let eventLink = tournamentLink.joined(separator: "\n") + link.append(eventLink) + } + link.append("\n\n") link.append("Retrouvez toutes les infos en suivant le\(tournaments.count.pluralSuffix) lien\(tournaments.count.pluralSuffix) ci-dessous :") link.append("\n\n") @@ -150,12 +164,8 @@ struct EventSettingsView: View { }) .toolbarBackground(.visible, for: .navigationBar) .toolbar { - if let tenupId = event.tenupId { - ToolbarItem(placement: .topBarTrailing) { - Link(destination: URL(string:"https://tenup.fft.fr/tournoi/\(tenupId)")!) { - Text("Tenup") - } - } + ToolbarItem(placement: .topBarTrailing) { + _linkLabel() } if focusedField != nil { @@ -200,6 +210,23 @@ struct EventSettingsView: View { } } + private func _linkLabel() -> some View { + Menu { + if let url = event.shareURL() { + ShareLink(item: url) { + Text("Lien de l'événement sur Padel Club") + } + } + if let tenupId = event.tenupId { + ShareLink(item: URL(string:"https://tenup.fft.fr/tournoi/\(tenupId)")!) { + Text("Tenup") + } + } + } label: { + Text("Liens") + } + } + private func _save() { dataStore.events.addOrUpdate(instance: event) } diff --git a/PadelClub/Views/Tournament/Screen/BroadcastView.swift b/PadelClub/Views/Tournament/Screen/BroadcastView.swift index 54eb097..5382d73 100644 --- a/PadelClub/Views/Tournament/Screen/BroadcastView.swift +++ b/PadelClub/Views/Tournament/Screen/BroadcastView.swift @@ -321,6 +321,9 @@ struct BroadcastView: View { Section { let club = tournament.club() actionForURL(title: (club == nil) ? "Aucun club indiqué pour ce tournoi" : club!.clubTitle(), description: "Page du club", url: club?.shareURL()) + if let event = tournament.eventObject() { + actionForURL(title: event.eventTitle(), description: "Page de l'évémement", url: event.shareURL()) + } actionForURL(title: "Padel Club", url: URLs.main.url) } header: { Text("Autres liens")