Compare the networkId against the correct enum in eth and token overview components (#9485)

feature/default_network_editable
Dan J Miller 4 years ago committed by GitHub
parent dd3c2cc3ec
commit 94810ce9c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      ui/app/components/app/wallet-overview/eth-overview.js
  2. 5
      ui/app/components/app/wallet-overview/token-overview.js

@ -20,6 +20,7 @@ import SendIcon from '../../ui/icon/overview-send-icon.component'
import { getSwapsFeatureLiveness, setSwapsFromToken } from '../../../ducks/swaps/swaps' import { getSwapsFeatureLiveness, setSwapsFromToken } from '../../../ducks/swaps/swaps'
import { ETH_SWAPS_TOKEN_OBJECT } from '../../../helpers/constants/swaps' import { ETH_SWAPS_TOKEN_OBJECT } from '../../../helpers/constants/swaps'
import IconButton from '../../ui/icon-button' import IconButton from '../../ui/icon-button'
import { MAINNET_NETWORK_ID } from '../../../../../app/scripts/controllers/network/enums'
import WalletOverview from './wallet-overview' import WalletOverview from './wallet-overview'
const EthOverview = ({ className }) => { const EthOverview = ({ className }) => {
@ -112,10 +113,10 @@ const EthOverview = ({ className }) => {
{swapsEnabled ? ( {swapsEnabled ? (
<IconButton <IconButton
className="eth-overview__button" className="eth-overview__button"
disabled={networkId !== '1'} disabled={networkId !== MAINNET_NETWORK_ID}
Icon={SwapIcon} Icon={SwapIcon}
onClick={() => { onClick={() => {
if (networkId === '1') { if (networkId === MAINNET_NETWORK_ID) {
enteredSwapsEvent() enteredSwapsEvent()
dispatch(setSwapsFromToken({ dispatch(setSwapsFromToken({
...ETH_SWAPS_TOKEN_OBJECT, ...ETH_SWAPS_TOKEN_OBJECT,

@ -14,6 +14,7 @@ import { useTokenFiatAmount } from '../../../hooks/useTokenFiatAmount'
import { updateSendToken } from '../../../store/actions' import { updateSendToken } from '../../../store/actions'
import { getSwapsFeatureLiveness, setSwapsFromToken } from '../../../ducks/swaps/swaps' import { getSwapsFeatureLiveness, setSwapsFromToken } from '../../../ducks/swaps/swaps'
import { getAssetImages, getCurrentKeyring, getCurrentNetworkId } from '../../../selectors/selectors' import { getAssetImages, getCurrentKeyring, getCurrentNetworkId } from '../../../selectors/selectors'
import { MAINNET_NETWORK_ID } from '../../../../../app/scripts/controllers/network/enums'
import SwapIcon from '../../ui/icon/swap-icon.component' import SwapIcon from '../../ui/icon/swap-icon.component'
import SendIcon from '../../ui/icon/overview-send-icon.component' import SendIcon from '../../ui/icon/overview-send-icon.component'
@ -81,10 +82,10 @@ const TokenOverview = ({ className, token }) => {
{swapsEnabled ? ( {swapsEnabled ? (
<IconButton <IconButton
className="token-overview__button" className="token-overview__button"
disabled={networkId !== '1'} disabled={networkId !== MAINNET_NETWORK_ID}
Icon={SwapIcon} Icon={SwapIcon}
onClick={() => { onClick={() => {
if (networkId === '1') { if (networkId === MAINNET_NETWORK_ID) {
enteredSwapsEvent() enteredSwapsEvent()
dispatch(setSwapsFromToken({ ...token, iconUrl: assetImages[token.address] })) dispatch(setSwapsFromToken({ ...token, iconUrl: assetImages[token.address] }))
if (usingHardwareWallet) { if (usingHardwareWallet) {

Loading…
Cancel
Save