From 0b81b5bfd29a7def2547b814df93fa5cdfc80991 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 6 Mar 2024 16:51:13 +0800 Subject: [PATCH] Add menu item to copy handle --- src/components/ICONS.jsx | 1 + src/components/account-info.jsx | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/components/ICONS.jsx b/src/components/ICONS.jsx index 8e174d67..f9192671 100644 --- a/src/components/ICONS.jsx +++ b/src/components/ICONS.jsx @@ -102,4 +102,5 @@ export const ICONS = { document: () => import('@iconify-icons/mingcute/document-line'), 'arrows-right': () => import('@iconify-icons/mingcute/arrows-right-line'), code: () => import('@iconify-icons/mingcute/code-line'), + copy: () => import('@iconify-icons/mingcute/copy-2-line'), }; diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx index dc4b24c2..37e5f599 100644 --- a/src/components/account-info.jsx +++ b/src/components/account-info.jsx @@ -1053,6 +1053,27 @@ function RelatedActions({ )} + { + const handle = `@${currentInfo?.acct || acct}`; + try { + navigator.clipboard.writeText(handle); + showToast('Handle copied'); + } catch (e) { + console.error(e); + showToast('Unable to copy handle'); + } + }} + > + + + Copy handle +
+ + @{currentInfo?.acct || acct} + +
+
{niceAccountURL(url)}