Skip to content

Commit

Permalink
Rename prop for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Jan 14, 2025
1 parent 336b2ef commit d5f89fc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .changelog/1687.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a small regression in displaying account names
11 changes: 8 additions & 3 deletions src/app/components/Account/AccountLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ const WithTypographyAndLink: FC<{
}

interface Props {
showAddressAsName?: boolean
/**
* Should only show the address, never a name
*
* (Use this in situations when the name is already on the screen for some reason.)
*/
showOnlyAddress?: boolean
scope: SearchScope
address: string

Expand Down Expand Up @@ -80,7 +85,7 @@ interface Props {
}

export const AccountLink: FC<Props> = ({
showAddressAsName,
showOnlyAddress,
scope,
address,
alwaysTrim,
Expand All @@ -95,7 +100,7 @@ export const AccountLink: FC<Props> = ({
// isError, // Use this to indicate that we have failed to load the name for this account
} = useAccountMetadata(scope, address)
const accountName = accountMetadata?.name // TODO: we should also use the description
const showAccountName = !showAddressAsName && accountName
const showAccountName = !showOnlyAddress && !!accountName
const to = RouteUtils.getAccountRoute(scope, address)

const extraTooltipWithIcon = extraTooltip ? (
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Account/RuntimeAccountDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const RuntimeAccountDetailsView: FC<RuntimeAccountDetailsViewProps> = ({
</StyledListTitleWithAvatar>
<dd>
<AccountLink
showAddressAsName
showOnlyAddress
scope={account}
address={address!}
highlightedPartOfName={highlightedPartOfName}
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Tokens/TokenDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const TokenDetails: FC<{
<dd>
<span>
<AccountLink
showAddressAsName
showOnlyAddress
scope={token}
address={token.eth_contract_addr ?? token.contract_addr}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Tokens/TokenList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const TokenList = (props: TokensProps) => {
content: (
<span>
<AccountLink
showAddressAsName
showOnlyAddress
scope={token}
address={token.eth_contract_addr ?? token.contract_addr}
alwaysTrim
Expand Down
6 changes: 1 addition & 5 deletions src/app/pages/TokenDashboardPage/TokenDetailsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ export const TokenDetailsCard: FC<{ scope: SearchScope; address: string; searchT
)}
<dt>{t(isMobile ? 'common.smartContract_short' : 'common.smartContract')}</dt>
<dd>
<AccountLink
showAddressAsName
scope={account}
address={account.address_eth || account.address}
/>
<AccountLink showOnlyAddress scope={account} address={account.address_eth || account.address} />
<CopyToClipboard value={account.address_eth || account.address} />
</dd>

Expand Down

0 comments on commit d5f89fc

Please sign in to comment.