Further shorten name text if displayName === username

This commit is contained in:
Lim Chee Aun 2022-12-20 19:52:55 +08:00
parent 39efda9e38
commit 39a5634112

View file

@ -6,11 +6,13 @@ import states from '../utils/states';
import Avatar from './avatar'; import Avatar from './avatar';
function NameText({ account, showAvatar, showAcct, short, external }) { function NameText({ account, showAvatar, showAcct, short, external }) {
const { acct, avatar, avatarStatic, id, url, displayName, username, emojis } = const { acct, avatar, avatarStatic, id, url, displayName, emojis } = account;
account; let { username } = account;
const displayNameWithEmoji = emojifyText(displayName, emojis); const displayNameWithEmoji = emojifyText(displayName, emojis);
if (username === displayName) username = null;
return ( return (
<a <a
class={`name-text ${short ? 'short' : ''}`} class={`name-text ${short ? 'short' : ''}`}
@ -35,7 +37,7 @@ function NameText({ account, showAvatar, showAcct, short, external }) {
__html: displayNameWithEmoji, __html: displayNameWithEmoji,
}} }}
/> />
{!showAcct && ( {!showAcct && username && (
<> <>
{' '} {' '}
<i>@{username}</i> <i>@{username}</i>