Skip to content

Commit

Permalink
add view account-details menu item to token-options menu (#10932)
Browse files Browse the repository at this point in the history
* add view account-details menu item to token-options menu

* add onViewAccountDetails propType
  • Loading branch information
Alex Donesky authored Apr 26, 2021
1 parent eaec68d commit 5bde528
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ui/app/pages/asset/components/token-asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export default function TokenAsset({ token }) {
);
global.platform.openTab({ url });
}}
onViewAccountDetails={() => {
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }));
}}
tokenSymbol={token.symbol}
/>
}
Expand Down
18 changes: 17 additions & 1 deletion ui/app/pages/asset/components/token-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"
Expand Down Expand Up @@ -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,
};

Expand Down

0 comments on commit 5bde528

Please sign in to comment.