From af5a7a35c044d09cd704cd1559b7355f76d0b1e8 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 2 Apr 2024 06:14:54 -0700 Subject: [PATCH] refac: copy to clipboard message --- src/lib/components/layout/Navbar.svelte | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/lib/components/layout/Navbar.svelte b/src/lib/components/layout/Navbar.svelte index 8729029fc..e7079a735 100644 --- a/src/lib/components/layout/Navbar.svelte +++ b/src/lib/components/layout/Navbar.svelte @@ -67,21 +67,17 @@ const shareLocalChat = async () => { const chat = await getChatById(localStorage.token, $chatId); - console.log('shareLocal', chat); + + let chatShareUrl = ''; if (chat.share_id) { - const shareUrl = `${window.location.origin}/s/${chat.share_id}`; - toast.success( - $i18n.t('Chat is already shared at {{shareUrl}}, copied to clipboard', { shareUrl }) - ); - copyToClipboard(shareUrl); + chatShareUrl = `${window.location.origin}/s/${chat.share_id}`; } else { const sharedChat = await shareChatById(localStorage.token, $chatId); - const shareUrl = `${window.location.origin}/s/${sharedChat.id}`; - toast.success( - $i18n.t('Chat is now shared at {{shareUrl}}, copied to clipboard', { shareUrl }) - ); - copyToClipboard(shareUrl); + chatShareUrl = `${window.location.origin}/s/${sharedChat.id}`; } + + toast.success($i18n.t('Copied shared conversation URL to clipboard!')); + copyToClipboard(chatShareUrl); }; const downloadChat = async () => {