Commit acdca350 authored by cartcrom's avatar cartcrom Committed by GitHub

refactor: removing duplicate AccountDetails code (#4329)

fixed redundant code
parent fe55c7ae
...@@ -129,7 +129,7 @@ const AccountControl = styled.div` ...@@ -129,7 +129,7 @@ const AccountControl = styled.div`
} }
` `
const AddressLink = styled(ExternalLink)<{ hasENS: boolean; isENS: boolean }>` const AddressLink = styled(ExternalLink)`
font-size: 0.825rem; font-size: 0.825rem;
color: ${({ theme }) => theme.deprecated_text3}; color: ${({ theme }) => theme.deprecated_text3};
margin-left: 1rem; margin-left: 1rem;
...@@ -281,59 +281,21 @@ export default function AccountDetails({ ...@@ -281,59 +281,21 @@ export default function AccountDetails({
</AccountControl> </AccountControl>
</AccountGroupingRow> </AccountGroupingRow>
<AccountGroupingRow> <AccountGroupingRow>
{ENSName ? (
<>
<AccountControl>
<div>
{account && (
<CopyHelper toCopy={account} iconPosition="left">
<span style={{ marginLeft: '4px' }}>
<Trans>Copy Address</Trans>
</span>
</CopyHelper>
)}
{chainId && account && (
<AddressLink
hasENS={!!ENSName}
isENS={true}
href={getExplorerLink(chainId, ENSName, ExplorerDataType.ADDRESS)}
>
<LinkIcon size={16} />
<span style={{ marginLeft: '4px' }}>
<Trans>View on Explorer</Trans>
</span>
</AddressLink>
)}
</div>
</AccountControl>
</>
) : (
<>
<AccountControl> <AccountControl>
<div> <div>
{account && ( {account && (
<CopyHelper toCopy={account} iconPosition="left"> <CopyHelper toCopy={account} iconPosition="left">
<span style={{ marginLeft: '4px' }}>
<Trans>Copy Address</Trans> <Trans>Copy Address</Trans>
</span>
</CopyHelper> </CopyHelper>
)} )}
{chainId && account && ( {chainId && account && (
<AddressLink <AddressLink href={getExplorerLink(chainId, ENSName ?? account, ExplorerDataType.ADDRESS)}>
hasENS={!!ENSName}
isENS={false}
href={getExplorerLink(chainId, account, ExplorerDataType.ADDRESS)}
>
<LinkIcon size={16} /> <LinkIcon size={16} />
<span style={{ marginLeft: '4px' }}>
<Trans>View on Explorer</Trans> <Trans>View on Explorer</Trans>
</span>
</AddressLink> </AddressLink>
)} )}
</div> </div>
</AccountControl> </AccountControl>
</>
)}
</AccountGroupingRow> </AccountGroupingRow>
</InfoCard> </InfoCard>
</YourAccount> </YourAccount>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment