Fix bug trying to switch accounts
In the profile dropdown, you couldn't click the avatar or the user's name because we had the `to` attribute on the LinkEl. This fixes that by only adding the link props when we render a Link.
This commit is contained in:
parent
7944de8305
commit
18be78475c
1 changed files with 7 additions and 10 deletions
|
@ -179,6 +179,11 @@ const Account = ({
|
|||
if (withDate) timestamp = account.created_at;
|
||||
|
||||
const LinkEl: any = withLinkToProfile ? Link : 'div';
|
||||
const linkProps = withLinkToProfile ? {
|
||||
to: `/@${account.acct}`,
|
||||
title: account.acct,
|
||||
onClick: (event: React.MouseEvent) => event.stopPropagation(),
|
||||
} : {};
|
||||
|
||||
return (
|
||||
<div data-testid='account' className='group block w-full shrink-0' ref={overflowRef}>
|
||||
|
@ -188,11 +193,7 @@ const Account = ({
|
|||
condition={showProfileHoverCard}
|
||||
wrapper={(children) => <HoverRefWrapper className='relative' accountId={account.id} inline>{children}</HoverRefWrapper>}
|
||||
>
|
||||
<LinkEl
|
||||
to={`/@${account.acct}`}
|
||||
title={account.acct}
|
||||
onClick={(event: React.MouseEvent) => event.stopPropagation()}
|
||||
>
|
||||
<LinkEl {...linkProps}>
|
||||
<Avatar src={account.avatar} size={avatarSize} />
|
||||
{emoji && (
|
||||
<Emoji
|
||||
|
@ -209,11 +210,7 @@ const Account = ({
|
|||
condition={showProfileHoverCard}
|
||||
wrapper={(children) => <HoverRefWrapper accountId={account.id} inline>{children}</HoverRefWrapper>}
|
||||
>
|
||||
<LinkEl
|
||||
to={`/@${account.acct}`}
|
||||
title={account.acct}
|
||||
onClick={(event: React.MouseEvent) => event.stopPropagation()}
|
||||
>
|
||||
<LinkEl {...linkProps}>
|
||||
<HStack space={1} alignItems='center' grow>
|
||||
<Text
|
||||
size='sm'
|
||||
|
|
Loading…
Reference in a new issue