From 1dfb964dd2eaf29c05e07cbbe56837ed070dd9c2 Mon Sep 17 00:00:00 2001 From: SauceyRed Date: Sun, 13 Jul 2025 00:40:20 +0200 Subject: [PATCH] feat: add buttons for copying invite in link and plain code forms --- components/InviteModal.vue | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/components/InviteModal.vue b/components/InviteModal.vue index 743a28b..e43e660 100644 --- a/components/InviteModal.vue +++ b/components/InviteModal.vue @@ -2,8 +2,9 @@
-

{{ invite }}

- +

{{ invite }}

+ +
@@ -36,13 +37,25 @@ async function generateInvite(): Promise { return; } -function copyInvite() { - const inviteUrl = URL.parse(`invite/${invite.value}`, `${window.location.protocol}//${window.location.host}`); - navigator.clipboard.writeText(inviteUrl!.href); +function copyInvite(type: "link" | "code") { + if (!invite.value) return; + + if (type == "link") { + const inviteUrl = URL.parse(`invite/${invite.value}`, `${window.location.protocol}//${window.location.host}`); + if (inviteUrl) { + navigator.clipboard.writeText(inviteUrl.href); + } + } else { + navigator.clipboard.writeText(invite.value); + } } - \ No newline at end of file