1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

UX: Ensure block explorer link is for desired account (#20144)

This commit is contained in:
David Walsh 2023-07-25 11:59:22 -05:00 committed by GitHub
parent 25247d0300
commit 9310a95499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 3 deletions

View File

@ -138,6 +138,7 @@ export const AccountListItemMenu = ({
metricsLocation={METRICS_LOCATION}
closeMenu={closeMenu}
textProps={{ variant: TextVariant.bodySm }}
address={identity.address}
/>
{isRemovable ? (
<MenuItem

View File

@ -101,6 +101,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
<ViewExplorerMenuItem
metricsLocation={METRICS_LOCATION}
closeMenu={closeMenu}
address={address}
/>
<MenuItem
iconName={IconName.Connect}

View File

@ -18,7 +18,6 @@ import {
getBlockExplorerLinkText,
getCurrentChainId,
getRpcPrefsForCurrentProvider,
getSelectedAddress,
} from '../../../selectors';
import { getURLHostName } from '../../../helpers/utils/util';
import { NETWORKS_ROUTE } from '../../../helpers/constants/routes';
@ -27,15 +26,15 @@ export const ViewExplorerMenuItem = ({
metricsLocation,
closeMenu,
textProps,
address,
}) => {
const t = useI18nContext();
const trackEvent = useContext(MetaMetricsContext);
const history = useHistory();
const currentAddress = useSelector(getSelectedAddress);
const chainId = useSelector(getCurrentChainId);
const rpcPrefs = useSelector(getRpcPrefsForCurrentProvider);
const addressLink = getAccountLink(currentAddress, chainId, rpcPrefs);
const addressLink = getAccountLink(address, chainId, rpcPrefs);
const { blockExplorerUrl } = rpcPrefs;
const blockExplorerUrlSubTitle = getURLHostName(blockExplorerUrl);
@ -94,4 +93,5 @@ ViewExplorerMenuItem.propTypes = {
metricsLocation: PropTypes.string.isRequired,
closeMenu: PropTypes.func,
textProps: PropTypes.object,
address: PropTypes.string.isRequired,
};

View File

@ -10,6 +10,7 @@ const render = () => {
<ViewExplorerMenuItem
metricsLocation="Global Menu"
closeMenu={jest.fn()}
address="0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
/>,
store,
);