From 552ad249e5e7c0d7ed91b200905ef6356e5e2790 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 18 Mar 2024 11:48:15 +0800 Subject: [PATCH] Clean up the usernames --- src/components/account-block.jsx | 7 ++++--- src/components/name-text.jsx | 11 ++++++++--- src/pages/account-statuses.jsx | 8 ++++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/components/account-block.jsx b/src/components/account-block.jsx index 47c15774..487f7af2 100644 --- a/src/components/account-block.jsx +++ b/src/components/account-block.jsx @@ -33,7 +33,7 @@ function AccountBlock({ ████████
- +
); @@ -87,7 +87,7 @@ function AccountBlock({ class="account-block" href={url} target={external ? '_blank' : null} - title={`@${acct}`} + title={acct2 ? acct : `@${acct}`} onClick={(e) => { if (external) return; e.preventDefault(); @@ -121,7 +121,8 @@ function AccountBlock({ )}{' '} - @{acct1} + {acct2 ? '' : '@'} + {acct1} {acct2} {locked && ( diff --git a/src/components/name-text.jsx b/src/components/name-text.jsx index f807d631..8732ed57 100644 --- a/src/components/name-text.jsx +++ b/src/components/name-text.jsx @@ -50,7 +50,11 @@ function NameText({ class={`name-text ${showAcct ? 'show-acct' : ''} ${short ? 'short' : ''}`} href={url} target={external ? '_blank' : null} - title={`${displayName ? `${displayName} ` : ''}@${acct}`} + title={ + displayName + ? `${displayName} (${acct2 ? '' : '@'}${acct})` + : `${acct2 ? '' : '@'}${acct}` + } onClick={(e) => { if (external) return; e.preventDefault(); @@ -88,8 +92,9 @@ function NameText({ <>
- @{acct1} - {acct2} + {acct2 ? '' : '@'} + {acct1} + {!!acct2 && {acct2}} )} diff --git a/src/pages/account-statuses.jsx b/src/pages/account-statuses.jsx index fe8034a9..7cbe0878 100644 --- a/src/pages/account-statuses.jsx +++ b/src/pages/account-statuses.jsx @@ -206,8 +206,12 @@ function AccountStatuses() { const [featuredTags, setFeaturedTags] = useState([]); useTitle( account?.acct - ? `${account?.displayName ? account.displayName + ' ' : ''}@${ - account.acct + ? `${ + account?.displayName + ? `${account.displayName} (${/@/.test(account.acct) ? '' : '@'}${ + account.acct + })` + : `${/@/.test(account.acct) ? '' : '@'}${account.acct}` }${ !excludeReplies ? ' (+ Replies)'