|
|
|
|
@ -426,15 +426,11 @@ struct InscriptionManagerView: View { |
|
|
|
|
|
|
|
|
|
private func _sharingTeamsMenuView() -> some View { |
|
|
|
|
Menu { |
|
|
|
|
if let teamPaste = teamPaste() { |
|
|
|
|
ShareLink(item: teamPaste) { |
|
|
|
|
Text("En texte") |
|
|
|
|
} |
|
|
|
|
ShareLink(item: teamPaste(), preview: .init("Inscriptions")) { |
|
|
|
|
Text("En texte") |
|
|
|
|
} |
|
|
|
|
if let teamPaste = teamPaste(.csv) { |
|
|
|
|
ShareLink(item: teamPaste) { |
|
|
|
|
Text("En csv") |
|
|
|
|
} |
|
|
|
|
ShareLink(item: teamPaste(.csv), preview: .init("Inscriptions")) { |
|
|
|
|
Text("En csv") |
|
|
|
|
} |
|
|
|
|
} label: { |
|
|
|
|
Label("Exporter les paires", systemImage: "square.and.arrow.up") |
|
|
|
|
@ -449,8 +445,8 @@ struct InscriptionManagerView: View { |
|
|
|
|
tournament.unsortedTeamsWithoutWO() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func teamPaste(_ exportFormat: ExportFormat = .rawText) -> URL? { |
|
|
|
|
tournament.pasteDataForImporting(exportFormat).createFile(self.tournament.tournamentTitle(.short), exportFormat) |
|
|
|
|
func teamPaste(_ exportFormat: ExportFormat = .rawText) -> TournamentShareFile { |
|
|
|
|
TournamentShareFile(tournament: tournament, exportFormat: exportFormat) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var unsortedPlayers: [PlayerRegistration] { |
|
|
|
|
@ -1015,3 +1011,55 @@ struct InscriptionManagerView: View { |
|
|
|
|
// .environment(Tournament.mock()) |
|
|
|
|
// } |
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
struct TournamentRoundShareContent: Transferable { |
|
|
|
|
let tournament: Tournament |
|
|
|
|
|
|
|
|
|
func shareContent() -> String { |
|
|
|
|
print("Generating URL...") |
|
|
|
|
let content = tournament.rounds().compactMap { $0.pasteData() }.joined(separator: "\n\n") |
|
|
|
|
return content |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static var transferRepresentation: some TransferRepresentation { |
|
|
|
|
ProxyRepresentation { transferable in |
|
|
|
|
return transferable.shareContent() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct TournamentGroupStageShareContent: Transferable { |
|
|
|
|
let tournament: Tournament |
|
|
|
|
|
|
|
|
|
func shareContent() -> String { |
|
|
|
|
print("Generating URL...") |
|
|
|
|
let content = tournament.groupStages().compactMap { $0.pasteData() }.joined(separator: "\n\n") |
|
|
|
|
return content |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static var transferRepresentation: some TransferRepresentation { |
|
|
|
|
ProxyRepresentation { transferable in |
|
|
|
|
return transferable.shareContent() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct TournamentShareFile: Transferable { |
|
|
|
|
let tournament: Tournament |
|
|
|
|
let exportFormat: ExportFormat |
|
|
|
|
|
|
|
|
|
func shareFile() -> URL { |
|
|
|
|
print("Generating URL...") |
|
|
|
|
return tournament.pasteDataForImporting(exportFormat).createFile(self.tournament.tournamentTitle()+"-inscriptions", exportFormat) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static var transferRepresentation: some TransferRepresentation { |
|
|
|
|
FileRepresentation(exportedContentType: .utf8PlainText) { transferable in |
|
|
|
|
return SentTransferredFile(transferable.shareFile()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ProxyRepresentation { transferable in |
|
|
|
|
return transferable.shareFile() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|