1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

add view account-details menu item to token-options menu (#10932)

* add view account-details menu item to token-options menu

* add onViewAccountDetails propType
This commit is contained in:
Alex Donesky 2021-04-26 17:07:33 -05:00 committed by GitHub
parent eaec68da3a
commit 5bde528cbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -43,6 +43,9 @@ export default function TokenAsset({ token }) {
);
global.platform.openTab({ url });
}}
onViewAccountDetails={() => {
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }));
}}
tokenSymbol={token.symbol}
/>
}

View File

@ -4,7 +4,12 @@ import PropTypes from 'prop-types';
import { I18nContext } from '../../../contexts/i18n';
import { Menu, MenuItem } from '../../../components/ui/menu';
const TokenOptions = ({ onRemove, onViewEtherscan, tokenSymbol }) => {
const TokenOptions = ({
onRemove,
onViewEtherscan,
onViewAccountDetails,
tokenSymbol,
}) => {
const t = useContext(I18nContext);
const [tokenOptionsButtonElement, setTokenOptionsButtonElement] = useState(
null,
@ -25,6 +30,16 @@ const TokenOptions = ({ onRemove, onViewEtherscan, tokenSymbol }) => {
anchorElement={tokenOptionsButtonElement}
onHide={() => setTokenOptionsOpen(false)}
>
<MenuItem
iconClassName="fas fa-qrcode"
data-testid="token-options__account-details"
onClick={() => {
setTokenOptionsOpen(false);
onViewAccountDetails();
}}
>
{t('accountDetails')}
</MenuItem>
<MenuItem
iconClassName="fas fa-external-link-alt token-options__icon"
data-testid="token-options__etherscan"
@ -54,6 +69,7 @@ const TokenOptions = ({ onRemove, onViewEtherscan, tokenSymbol }) => {
TokenOptions.propTypes = {
onRemove: PropTypes.func.isRequired,
onViewEtherscan: PropTypes.func.isRequired,
onViewAccountDetails: PropTypes.func.isRequired,
tokenSymbol: PropTypes.string.isRequired,
};