Add menu item to copy handle

This commit is contained in:
Lim Chee Aun 2024-03-06 16:51:13 +08:00
parent b48d32e503
commit 0b81b5bfd2
2 changed files with 22 additions and 0 deletions

View file

@ -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'),
};

View file

@ -1053,6 +1053,27 @@ function RelatedActions({
<MenuDivider />
</>
)}
<MenuItem
onClick={() => {
const handle = `@${currentInfo?.acct || acct}`;
try {
navigator.clipboard.writeText(handle);
showToast('Handle copied');
} catch (e) {
console.error(e);
showToast('Unable to copy handle');
}
}}
>
<Icon icon="copy" />
<small>
Copy handle
<br />
<span class="more-insignificant">
@{currentInfo?.acct || acct}
</span>
</small>
</MenuItem>
<MenuItem href={url} target="_blank">
<Icon icon="external" />
<small class="menu-double-lines">{niceAccountURL(url)}</small>