1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

Fix #847 - Don't show account address on token pages (#19740)

Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
This commit is contained in:
David Walsh 2023-06-26 11:13:26 -05:00 committed by GitHub
parent 55a8ff249c
commit e37e570b2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 15 deletions

View File

@ -49,7 +49,7 @@ import useRamps from '../../../hooks/experiences/useRamps';
import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
import WalletOverview from './wallet-overview';
const EthOverview = ({ className }) => {
const EthOverview = ({ className, showAddress }) => {
const dispatch = useDispatch();
const t = useContext(I18nContext);
const trackEvent = useContext(MetaMetricsContext);
@ -121,6 +121,7 @@ const EthOverview = ({ className }) => {
return (
<WalletOverview
showAddress={showAddress}
balance={
<Tooltip
position="top"
@ -365,10 +366,7 @@ const EthOverview = ({ className }) => {
EthOverview.propTypes = {
className: PropTypes.string,
};
EthOverview.defaultProps = {
className: undefined,
showAddress: PropTypes.bool,
};
export default EthOverview;

View File

@ -83,6 +83,7 @@ const TokenOverview = ({ className, token }) => {
return (
<WalletOverview
showAddress={false}
balance={
<div className="token-overview__balance">
<div className="token-overview__primary-container">

View File

@ -7,15 +7,22 @@ import { getSelectedIdentity } from '../../../selectors';
import { AddressCopyButton } from '../../multichain';
import Box from '../../ui/box/box';
const WalletOverview = ({ balance, buttons, className }) => {
const WalletOverview = ({
balance,
buttons,
className,
showAddress = false,
}) => {
const selectedIdentity = useSelector(getSelectedIdentity);
const checksummedAddress = toChecksumHexAddress(selectedIdentity?.address);
return (
<div className={classnames('wallet-overview', className)}>
<div className="wallet-overview__balance">
{showAddress ? (
<Box marginTop={2}>
<AddressCopyButton address={checksummedAddress} shorten />
</Box>
) : null}
{balance}
</div>
<div className="wallet-overview__buttons">{buttons}</div>
@ -27,10 +34,7 @@ WalletOverview.propTypes = {
balance: PropTypes.element.isRequired,
buttons: PropTypes.element.isRequired,
className: PropTypes.string,
};
WalletOverview.defaultProps = {
className: undefined,
showAddress: PropTypes.bool,
};
export default WalletOverview;

View File

@ -64,7 +64,7 @@ export default function NativeAsset({ nativeCurrency }) {
/>
}
/>
<EthOverview className="asset__overview" />
<EthOverview className="asset__overview" showAddress={false} />
<TransactionList hideTokenTransactions />
</>
);

View File

@ -778,12 +778,13 @@ export default class Home extends PureComponent {
<div className="home__balance-wrapper">
{
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
<EthOverview />
<EthOverview showAddress />
///: END:ONLY_INCLUDE_IN
}
{
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
<EthOverview
showAddress
mmiPortfolioEnabled={mmiPortfolioEnabled}
mmiPortfolioUrl={mmiPortfolioUrl}
/>