Skip to content

Commit

Permalink
removed address button from wallet overview
Browse files Browse the repository at this point in the history
  • Loading branch information
NidhiKJha committed Jan 31, 2024
1 parent a8a53b1 commit a7497f8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 51 deletions.
17 changes: 1 addition & 16 deletions ui/components/app/wallet-overview/wallet-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,21 @@ import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { useSelector } from 'react-redux';
import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils';
import { getSelectedInternalAccount } from '../../../selectors';
import { AddressCopyButton } from '../../multichain';
import Box from '../../ui/box/box';
import { IconName, Tag } from '../../component-library';
import { Color, TextVariant } from '../../../helpers/constants/design-system';
import { KeyringType } from '../../../../shared/constants/keyring';
import { getAccountLabel } from '../../../helpers/utils/accounts';

const WalletOverview = ({
balance,
buttons,
className,
showAddress = false,
}) => {
const WalletOverview = ({ balance, buttons, className }) => {
const selectedAccount = useSelector(getSelectedInternalAccount);
const checksummedAddress = toChecksumHexAddress(selectedAccount.address);
const { keyring } = selectedAccount.metadata;
const label = selectedAccount.metadata.snap?.name
? getAccountLabel(keyring.type, selectedAccount)
: null;
return (
<div className={classnames('wallet-overview', className)}>
<div className="wallet-overview__balance">
{showAddress ? (
<Box marginTop={2}>
<AddressCopyButton address={checksummedAddress} shorten />
</Box>
) : null}
{balance}
{label ? (
<Tag
Expand All @@ -54,7 +40,6 @@ WalletOverview.propTypes = {
balance: PropTypes.element.isRequired,
buttons: PropTypes.element.isRequired,
className: PropTypes.string,
showAddress: PropTypes.bool,
};

export default WalletOverview;
68 changes: 33 additions & 35 deletions ui/components/multichain/app-header/app-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,44 +314,42 @@ export const AppHeader = ({ location }) => {
disabled={disableAccountPicker}
labelProps={{ fontWeight: FontWeight.Bold }}
/>
{process.env.MULTICHAIN ? (
<Tooltip
position="left"
title={copied ? t('addressCopied') : null}
<Tooltip
position="left"
title={copied ? t('addressCopied') : null}
>
<ButtonBase
className="multichain-app-header__address-copy-button"
onClick={() => handleCopy(checksummedCurrentAddress)}
size={ButtonBaseSize.Sm}
backgroundColor={BackgroundColor.transparent}
borderRadius={BorderRadius.LG}
endIconName={
copied ? IconName.CopySuccess : IconName.Copy
}
endIconProps={{
color: IconColor.iconAlternative,
size: Size.SM,
}}
ellipsis
textProps={{
display: Display.Flex,
alignItems: AlignItems.center,
gap: 2,
}}
style={{ height: 'auto' }} // ButtonBase doesn't have auto size
data-testid="app-header-copy-button"
>
<ButtonBase
className="multichain-app-header__address-copy-button"
onClick={() => handleCopy(checksummedCurrentAddress)}
size={ButtonBaseSize.Sm}
backgroundColor={BackgroundColor.transparent}
borderRadius={BorderRadius.LG}
endIconName={
copied ? IconName.CopySuccess : IconName.Copy
}
endIconProps={{
color: IconColor.iconAlternative,
size: Size.SM,
}}
<Text
color={TextColor.textAlternative}
variant={TextVariant.bodySm}
ellipsis
textProps={{
display: Display.Flex,
alignItems: AlignItems.center,
gap: 2,
}}
style={{ height: 'auto' }} // ButtonBase doesn't have auto size
data-testid="app-header-copy-button"
as="span"
>
<Text
color={TextColor.textAlternative}
variant={TextVariant.bodySm}
ellipsis
as="span"
>
{shortenedAddress}
</Text>
</ButtonBase>
</Tooltip>
) : null}
{shortenedAddress}
</Text>
</ButtonBase>
</Tooltip>
</Box>
) : null}
<Box
Expand Down

0 comments on commit a7497f8

Please sign in to comment.