mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-27 18:10:58 +00:00
Merge 5e5069f2b7 into 002632c3bb
This commit is contained in:
commit
d0f710c690
|
|
@ -369,6 +369,19 @@ export const AccountHeader: React.FC<{
|
||||||
});
|
});
|
||||||
}, [account]);
|
}, [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 suspended = account?.suspended;
|
||||||
const isRemote = account?.acct !== account?.username;
|
const isRemote = account?.acct !== account?.username;
|
||||||
const remoteDomain = isRemote ? account?.acct.split('@')[1] : null;
|
const remoteDomain = isRemote ? account?.acct.split('@')[1] : null;
|
||||||
|
|
@ -820,7 +833,11 @@ export const AccountHeader: React.FC<{
|
||||||
<h1>
|
<h1>
|
||||||
<DisplayName account={account} variant='simple' />
|
<DisplayName account={account} variant='simple' />
|
||||||
<small>
|
<small>
|
||||||
<span>
|
<span
|
||||||
|
onClick={handleCopyUsername}
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
title={`Click to copy @${username}@${domain}`}
|
||||||
|
>
|
||||||
@{username}
|
@{username}
|
||||||
<span className='invisible'>@{domain}</span>
|
<span className='invisible'>@{domain}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user