diff --git a/app/javascript/mastodon/features/account_timeline/components/account_header.tsx b/app/javascript/mastodon/features/account_timeline/components/account_header.tsx index 2bf636d060d..7b94078c735 100644 --- a/app/javascript/mastodon/features/account_timeline/components/account_header.tsx +++ b/app/javascript/mastodon/features/account_timeline/components/account_header.tsx @@ -371,6 +371,19 @@ export const AccountHeader: React.FC<{ }); }, [account]); + const handleCopyUsername = useCallback(() => { + if (!account) { + return; + } + + const isLocal = !account.acct.includes('@'); + const username = account.acct.split('@')[0]; + const domain = isLocal ? localDomain : account.acct.split('@')[1]; + const fullHandle = `@${username}@${domain}`; + + void navigator.clipboard.writeText(fullHandle); + }, [account]); + const suspended = account?.suspended; const isRemote = account?.acct !== account?.username; const remoteDomain = isRemote ? account?.acct.split('@')[1] : null; @@ -822,7 +835,11 @@ export const AccountHeader: React.FC<{

- + @{username} @{domain}