Skip to content

Commit

Permalink
Merge branch 'develop' into replacing-constants
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvv173 authored Jul 4, 2023
2 parents 74b2f5c + fa84aa8 commit 69f09f1
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 57 deletions.
3 changes: 1 addition & 2 deletions shared/constants/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ export const BSC_DISPLAY_NAME = 'Binance Smart Chain';
export const POLYGON_DISPLAY_NAME = 'Polygon';
export const AVALANCHE_DISPLAY_NAME = 'Avalanche Network C-Chain';
export const ARBITRUM_DISPLAY_NAME = 'Arbitrum One';
export const BNB_DISPLAY_NAME =
'BNB Smart Chain (previously Binance Smart Chain Mainnet)';
export const BNB_DISPLAY_NAME = 'BNB Chain';
export const OPTIMISM_DISPLAY_NAME = 'Optimism';
export const FANTOM_DISPLAY_NAME = 'Fantom Opera';
export const HARMONY_DISPLAY_NAME = 'Harmony Mainnet Shard 0';
Expand Down
3 changes: 3 additions & 0 deletions test/jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ expect.extend({
};
},
});

// Setup window.prompt
global.prompt = () => undefined;
2 changes: 0 additions & 2 deletions ui/components/multichain/app-header/app-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
ButtonIcon,
ButtonIconSize,
IconName,
IconSize,
PickerNetwork,
} from '../../component-library';
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
Expand Down Expand Up @@ -360,7 +359,6 @@ export const AppHeader = ({ location }) => {
setAccountOptionsMenuOpen(true);
}}
size={ButtonIconSize.Sm}
iconProps={{ size: IconSize.Sm }}
/>
</Box>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion ui/components/multichain/app-header/app-header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import mockState from '../../../../test/data/mock-state.json';
import { SEND_STAGES } from '../../../ducks/send';
import { AppHeader } from '.';

const render = (stateChanges = {}, location = jest.fn()) => {
const render = (stateChanges = {}, location = {}) => {
const store = configureStore({
...mockState,
activeTab: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Connected Site Menu should render the site menu in connected state 1`] = `
<div>
<button
class="box multichain-connected-site-menu box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--background-color-background-default"
class="mm-box multichain-connected-site-menu mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center"
data-testid="connection-menu"
>
<div>
Expand All @@ -27,7 +27,7 @@ exports[`Connected Site Menu should render the site menu in connected state 1`]
style="bottom: 2px; right: -4px; z-index: 1;"
>
<div
class="box multichain-connected-site-menu__badge box--flex-direction-row box--background-color-success-default box--rounded-full box--border-color-background-default box--border-width-3 box--border-style-solid"
class="mm-box multichain-connected-site-menu__badge mm-box--background-color-success-default mm-box--rounded-full mm-box--border-color-background-default mm-box--border-width-3 box--border-style-solid"
/>
</div>
</div>
Expand All @@ -40,7 +40,7 @@ exports[`Connected Site Menu should render the site menu in connected state 1`]
exports[`Connected Site Menu should render the site menu in not connected state 1`] = `
<div>
<button
class="box multichain-connected-site-menu box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--background-color-background-default"
class="mm-box multichain-connected-site-menu mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center"
data-testid="connection-menu"
>
<div>
Expand All @@ -64,7 +64,7 @@ exports[`Connected Site Menu should render the site menu in not connected state
style="bottom: 2px; right: -4px; z-index: 1;"
>
<div
class="box multichain-connected-site-menu__badge box--flex-direction-row box--background-color-icon-alternative box--rounded-full box--border-color-background-default box--border-width-3 box--border-style-solid"
class="mm-box multichain-connected-site-menu__badge mm-box--background-color-icon-alternative mm-box--rounded-full mm-box--border-color-background-default mm-box--border-width-3 box--border-style-solid"
/>
</div>
</div>
Expand All @@ -77,7 +77,7 @@ exports[`Connected Site Menu should render the site menu in not connected state
exports[`Connected Site Menu should render the site menu in not connected to current account state 1`] = `
<div>
<button
class="box multichain-connected-site-menu box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--background-color-background-default"
class="mm-box multichain-connected-site-menu mm-box--display-flex mm-box--justify-content-center mm-box--align-items-center"
data-testid="connection-menu"
>
<div>
Expand All @@ -101,7 +101,7 @@ exports[`Connected Site Menu should render the site menu in not connected to cur
style="bottom: 4px; right: -1px; z-index: 1;"
>
<div
class="box multichain-connected-site-menu__badge not-connected box--flex-direction-row box--background-color-background-default box--rounded-full box--border-color-success-default box--border-width-2 box--border-style-solid"
class="mm-box multichain-connected-site-menu__badge not-connected mm-box--background-color-background-default mm-box--rounded-full mm-box--border-color-success-default mm-box--border-width-2 box--border-style-solid"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
Icon,
IconName,
IconSize,
Box,
} from '../../component-library';
import Box from '../../ui/box';
import { getSelectedIdentity } from '../../../selectors';
import Tooltip from '../../ui/tooltip';
import { useI18nContext } from '../../../hooks/useI18nContext';
Expand All @@ -44,7 +44,6 @@ export const ConnectedSiteMenu = ({
display={Display.Flex}
alignItems={AlignItems.center}
justifyContent={JustifyContent.center}
backgroundColor={BackgroundColor.backgroundDefault}
>
<Tooltip
title={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('DetectedTokensBanner', () => {
description: 'Find your connected accounts and manage permissions here.',
currentStep: '1',
totalSteps: '3',
closeMenu: jest.fn(),
};
it('should render correctly', () => {
const { getByTestId } = render(
Expand Down
1 change: 0 additions & 1 deletion ui/pages/asset/asset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

.asset-navigation {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
height: 64px;
Expand Down
4 changes: 0 additions & 4 deletions ui/pages/asset/components/asset-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@ AssetNavigation.propTypes = {
optionsButton: PropTypes.element,
};

AssetNavigation.defaultProps = {
optionsButton: undefined,
};

export default AssetNavigation;
19 changes: 6 additions & 13 deletions ui/pages/asset/components/asset-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ import { I18nContext } from '../../../contexts/i18n';
import { Menu, MenuItem } from '../../../components/ui/menu';
import { getBlockExplorerLinkText } from '../../../selectors';
import { NETWORKS_ROUTE } from '../../../helpers/constants/routes';
import { ButtonIcon, IconName } from '../../../components/component-library';
import {
ButtonIcon,
ButtonIconSize,
IconName,
} from '../../../components/component-library';
import { Color } from '../../../helpers/constants/design-system';

const AssetOptions = ({
onRemove,
onClickBlockExplorer,
onViewAccountDetails,
onViewTokenDetails,
tokenSymbol,
isNativeAsset,
Expand Down Expand Up @@ -42,22 +45,13 @@ const AssetOptions = ({
ariaLabel={t('assetOptions')}
iconName={IconName.MoreVertical}
color={Color.textDefault}
size={ButtonIconSize.Sm}
/>
{assetOptionsOpen ? (
<Menu
anchorElement={ref.current}
onHide={() => setAssetOptionsOpen(false)}
>
<MenuItem
iconName={IconName.ScanBarcode}
data-testid="asset-options__account-details"
onClick={() => {
setAssetOptionsOpen(false);
onViewAccountDetails();
}}
>
{t('accountDetails')}
</MenuItem>
<MenuItem
iconName={IconName.Export}
data-testid="asset-options__etherscan"
Expand Down Expand Up @@ -111,7 +105,6 @@ const isNotFunc = (p) => {
AssetOptions.propTypes = {
isNativeAsset: PropTypes.bool,
onClickBlockExplorer: PropTypes.func.isRequired,
onViewAccountDetails: PropTypes.func.isRequired,
onRemove: (props) => {
if (props.isNativeAsset === false && isNotFunc(props.onRemove)) {
throw new Error(
Expand Down
7 changes: 1 addition & 6 deletions ui/pages/asset/components/native-asset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { useSelector, useDispatch } from 'react-redux';
import { useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { getAccountLink } from '@metamask/etherscan-link';
import TransactionList from '../../../components/app/transaction-list';
Expand All @@ -12,7 +12,6 @@ import {
getSelectedAddress,
getIsCustomNetwork,
} from '../../../selectors/selectors';
import { showModal } from '../../../store/actions';
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes';
import { getURLHostName } from '../../../helpers/utils/util';
import { MetaMetricsContext } from '../../../contexts/metametrics';
Expand All @@ -24,7 +23,6 @@ export default function NativeAsset({ nativeCurrency }) {
const selectedAccountName = useSelector(
(state) => getSelectedIdentity(state).name,
);
const dispatch = useDispatch();

const chainId = useSelector(getCurrentChainId);
const rpcPrefs = useSelector(getRpcPrefsForCurrentProvider);
Expand Down Expand Up @@ -57,9 +55,6 @@ export default function NativeAsset({ nativeCurrency }) {
url: accountLink,
});
}}
onViewAccountDetails={() => {
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }));
}}
isCustomNetwork={isCustomNetwork}
/>
}
Expand Down
3 changes: 0 additions & 3 deletions ui/pages/asset/components/token-asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ export default function TokenAsset({ token }) {
});
global.platform.openTab({ url: tokenTrackerLink });
}}
onViewAccountDetails={() => {
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }));
}}
onViewTokenDetails={() => {
history.push(`${TOKEN_DETAILS}/${token.address}`);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,8 @@ export default class SendAssetRow extends Component {

renderNativeCurrency(insideDropdown = false) {
const { t } = this.context;
const {
accounts,
selectedAddress,
nativeCurrency,
nativeCurrencyImage,
sendAsset,
} = this.props;

const { accounts, selectedAddress, nativeCurrency, nativeCurrencyImage } =
this.props;
const { sendableTokens, sendableNfts } = this.state;

const balanceValue = accounts[selectedAddress]
Expand All @@ -211,15 +205,11 @@ export default class SendAssetRow extends Component {
onClick={() => this.selectToken(AssetType.native)}
>
<div className="send-v2__asset-dropdown__asset-icon">
{sendAsset?.type === AssetType.NFT && sendAsset?.details?.image ? (
<img width={36} src={sendAsset.details.image} />
) : (
<Identicon
diameter={36}
image={nativeCurrencyImage}
address={nativeCurrency}
/>
)}
<Identicon
diameter={36}
image={nativeCurrencyImage}
address={nativeCurrency}
/>
</div>
<div className="send-v2__asset-dropdown__asset-data">
<div className="send-v2__asset-dropdown__symbol">
Expand Down

0 comments on commit 69f09f1

Please sign in to comment.