mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
parent
ff843c1b10
commit
edb2c9ea00
@ -1,5 +1,6 @@
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
|
import { ICON_NAMES } from '../../component-library';
|
||||||
import { MenuItem } from '../../ui/menu';
|
import { MenuItem } from '../../ui/menu';
|
||||||
import ConnectedAccountsListItem from './connected-accounts-list-item';
|
import ConnectedAccountsListItem from './connected-accounts-list-item';
|
||||||
import ConnectedAccountsListOptions from './connected-accounts-list-options';
|
import ConnectedAccountsListOptions from './connected-accounts-list-options';
|
||||||
@ -104,7 +105,7 @@ export default class ConnectedAccountsList extends PureComponent {
|
|||||||
onShowOptions={this.showAccountOptions.bind(null, address)}
|
onShowOptions={this.showAccountOptions.bind(null, address)}
|
||||||
show={accountWithOptionsShown === address}
|
show={accountWithOptionsShown === address}
|
||||||
>
|
>
|
||||||
<MenuItem iconClassName="fa fa-ban" onClick={this.disconnectAccount}>
|
<MenuItem iconName={ICON_NAMES.LOGOUT} onClick={this.disconnectAccount}>
|
||||||
{t('disconnectThisAccount')}
|
{t('disconnectThisAccount')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</ConnectedAccountsListOptions>
|
</ConnectedAccountsListOptions>
|
||||||
|
@ -24,6 +24,7 @@ import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app';
|
|||||||
import { HardwareKeyringTypes } from '../../../../shared/constants/hardware-wallets';
|
import { HardwareKeyringTypes } from '../../../../shared/constants/hardware-wallets';
|
||||||
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
|
||||||
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
import { MetaMetricsContext } from '../../../contexts/metametrics';
|
||||||
|
import { ICON_NAMES } from '../../component-library';
|
||||||
|
|
||||||
export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
||||||
const t = useI18nContext();
|
const t = useI18nContext();
|
||||||
@ -82,7 +83,7 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
|||||||
</span>
|
</span>
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
iconClassName="fas fa-external-link-alt"
|
iconName={ICON_NAMES.EXPORT}
|
||||||
>
|
>
|
||||||
{t(
|
{t(
|
||||||
blockExplorerLinkText.firstPart,
|
blockExplorerLinkText.firstPart,
|
||||||
@ -104,7 +105,7 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
|||||||
global.platform.openExtensionInBrowser();
|
global.platform.openExtensionInBrowser();
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
iconClassName="fas fa-expand-alt"
|
iconName={ICON_NAMES.EXPAND}
|
||||||
>
|
>
|
||||||
{t('expandView')}
|
{t('expandView')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@ -122,7 +123,7 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
|||||||
});
|
});
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
iconClassName="fas fa-qrcode"
|
iconName={ICON_NAMES.SCAN_BARCODE}
|
||||||
>
|
>
|
||||||
{t('accountDetails')}
|
{t('accountDetails')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@ -139,7 +140,7 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
|||||||
history.push(CONNECTED_ROUTE);
|
history.push(CONNECTED_ROUTE);
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
iconClassName="fa fa-bullseye"
|
iconName={ICON_NAMES.CONNECT}
|
||||||
>
|
>
|
||||||
{t('connectedSites')}
|
{t('connectedSites')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
@ -155,7 +156,7 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
|||||||
);
|
);
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
iconClassName="fas fa-trash-alt"
|
iconName={ICON_NAMES.TRASH}
|
||||||
>
|
>
|
||||||
{t('removeAccount')}
|
{t('removeAccount')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
@ -8,7 +8,6 @@ const MenuItem = ({
|
|||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
'data-testid': dataTestId,
|
'data-testid': dataTestId,
|
||||||
iconClassName,
|
|
||||||
iconName,
|
iconName,
|
||||||
onClick,
|
onClick,
|
||||||
subtitle,
|
subtitle,
|
||||||
@ -18,9 +17,6 @@ const MenuItem = ({
|
|||||||
data-testid={dataTestId}
|
data-testid={dataTestId}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{iconClassName ? (
|
|
||||||
<i className={classnames('menu-item__icon', iconClassName)} />
|
|
||||||
) : null}
|
|
||||||
{iconName ? (
|
{iconName ? (
|
||||||
<Icon name={iconName} size={ICON_SIZES.SM} marginRight={2} />
|
<Icon name={iconName} size={ICON_SIZES.SM} marginRight={2} />
|
||||||
) : null}
|
) : null}
|
||||||
@ -33,7 +29,6 @@ MenuItem.propTypes = {
|
|||||||
children: PropTypes.node.isRequired,
|
children: PropTypes.node.isRequired,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
'data-testid': PropTypes.string,
|
'data-testid': PropTypes.string,
|
||||||
iconClassName: PropTypes.string,
|
|
||||||
iconName: PropTypes.string,
|
iconName: PropTypes.string,
|
||||||
onClick: PropTypes.func,
|
onClick: PropTypes.func,
|
||||||
subtitle: PropTypes.node,
|
subtitle: PropTypes.node,
|
||||||
@ -42,7 +37,6 @@ MenuItem.propTypes = {
|
|||||||
MenuItem.defaultProps = {
|
MenuItem.defaultProps = {
|
||||||
className: undefined,
|
className: undefined,
|
||||||
'data-testid': undefined,
|
'data-testid': undefined,
|
||||||
iconClassName: undefined,
|
|
||||||
iconName: undefined,
|
iconName: undefined,
|
||||||
onClick: undefined,
|
onClick: undefined,
|
||||||
subtitle: undefined,
|
subtitle: undefined,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { action } from '@storybook/addon-actions';
|
import { action } from '@storybook/addon-actions';
|
||||||
|
import { ICON_NAMES } from '../../component-library';
|
||||||
import { Menu, MenuItem } from '.';
|
import { Menu, MenuItem } from '.';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -9,11 +10,11 @@ export default {
|
|||||||
export const DefaultStory = () => {
|
export const DefaultStory = () => {
|
||||||
return (
|
return (
|
||||||
<Menu onHide={action('Hide')}>
|
<Menu onHide={action('Hide')}>
|
||||||
<MenuItem iconClassName="fas fa-bullseye" onClick={action('Menu Item 1')}>
|
<MenuItem iconName={ICON_NAMES.EYE} onClick={action('Menu Item 1')}>
|
||||||
Menu Item 1
|
Menu Item 1
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={action('Menu Item 2')}>Menu Item 2</MenuItem>
|
<MenuItem onClick={action('Menu Item 2')}>Menu Item 2</MenuItem>
|
||||||
<MenuItem iconClassName="fas fa-bold" onClick={action('Menu Item 3')}>
|
<MenuItem iconName={ICON_NAMES.EYE_SLASH} onClick={action('Menu Item 3')}>
|
||||||
Menu Item 3
|
Menu Item 3
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
@ -28,14 +29,14 @@ export const Anchored = () => {
|
|||||||
<>
|
<>
|
||||||
<button ref={setAnchorElement}>Menu</button>
|
<button ref={setAnchorElement}>Menu</button>
|
||||||
<Menu anchorElement={anchorElement} onHide={action('Hide')}>
|
<Menu anchorElement={anchorElement} onHide={action('Hide')}>
|
||||||
<MenuItem
|
<MenuItem iconName={ICON_NAMES.EXPORT} onClick={action('Menu Item 1')}>
|
||||||
iconClassName="fas fa-bullseye"
|
|
||||||
onClick={action('Menu Item 1')}
|
|
||||||
>
|
|
||||||
Menu Item 1
|
Menu Item 1
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={action('Menu Item 2')}>Menu Item 2</MenuItem>
|
<MenuItem onClick={action('Menu Item 2')}>Menu Item 2</MenuItem>
|
||||||
<MenuItem iconClassName="fas fa-bold" onClick={action('Menu Item 3')}>
|
<MenuItem
|
||||||
|
iconName={ICON_NAMES.EYE_SLSH}
|
||||||
|
onClick={action('Menu Item 3')}
|
||||||
|
>
|
||||||
Menu Item 3
|
Menu Item 3
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@ -7,6 +7,7 @@ import { I18nContext } from '../../../contexts/i18n';
|
|||||||
import { Menu, MenuItem } from '../../../components/ui/menu';
|
import { Menu, MenuItem } from '../../../components/ui/menu';
|
||||||
import { getBlockExplorerLinkText } from '../../../selectors';
|
import { getBlockExplorerLinkText } from '../../../selectors';
|
||||||
import { NETWORKS_ROUTE } from '../../../helpers/constants/routes';
|
import { NETWORKS_ROUTE } from '../../../helpers/constants/routes';
|
||||||
|
import { ICON_NAMES } from '../../../components/component-library';
|
||||||
|
|
||||||
const AssetOptions = ({
|
const AssetOptions = ({
|
||||||
onRemove,
|
onRemove,
|
||||||
@ -47,7 +48,7 @@ const AssetOptions = ({
|
|||||||
onHide={() => setAssetOptionsOpen(false)}
|
onHide={() => setAssetOptionsOpen(false)}
|
||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
iconClassName="fas fa-qrcode"
|
iconName={ICON_NAMES.SCAN_BARCODE}
|
||||||
data-testid="asset-options__account-details"
|
data-testid="asset-options__account-details"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setAssetOptionsOpen(false);
|
setAssetOptionsOpen(false);
|
||||||
@ -57,7 +58,7 @@ const AssetOptions = ({
|
|||||||
{t('accountDetails')}
|
{t('accountDetails')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
iconClassName="fas fa-external-link-alt asset-options__icon"
|
iconName={ICON_NAMES.EXPORT}
|
||||||
data-testid="asset-options__etherscan"
|
data-testid="asset-options__etherscan"
|
||||||
onClick={
|
onClick={
|
||||||
blockExplorerLinkText.firstPart === 'addBlockExplorer'
|
blockExplorerLinkText.firstPart === 'addBlockExplorer'
|
||||||
@ -74,7 +75,7 @@ const AssetOptions = ({
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
{isNativeAsset ? null : (
|
{isNativeAsset ? null : (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
iconClassName="fas fa-trash-alt asset-options__icon"
|
iconName={ICON_NAMES.TRASH}
|
||||||
data-testid="asset-options__hide"
|
data-testid="asset-options__hide"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setAssetOptionsOpen(false);
|
setAssetOptionsOpen(false);
|
||||||
@ -86,7 +87,7 @@ const AssetOptions = ({
|
|||||||
)}
|
)}
|
||||||
{isNativeAsset ? null : (
|
{isNativeAsset ? null : (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
iconClassName="fas fa-info-circle asset-options__icon"
|
iconName={ICON_NAMES.INFO}
|
||||||
data-testid="asset-options__token-details"
|
data-testid="asset-options__token-details"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setAssetOptionsOpen(false);
|
setAssetOptionsOpen(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user