From 77581256ca0872f13c54e7cff110c9234a0c5d19 Mon Sep 17 00:00:00 2001 From: Niranjana Binoy <43930900+NiranjanaBinoy@users.noreply.github.com> Date: Mon, 27 Sep 2021 13:42:51 -0400 Subject: [PATCH] Hiding refresh list on non-Mainnet networks (#12210) --- app/_locales/en/messages.json | 3 ++ ui/components/app/asset-list/asset-list.js | 3 ++ .../import-token-link.component.js | 32 +++++++++++++------ .../app/import-token-link/index.scss | 2 +- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index f919903dc..1d27a4d5d 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -1632,6 +1632,9 @@ "optionalCurrencySymbol": { "message": "Currency Symbol (optional)" }, + "or": { + "message": "or" + }, "origin": { "message": "Origin" }, diff --git a/ui/components/app/asset-list/asset-list.js b/ui/components/app/asset-list/asset-list.js index 1353b8bd9..193b22619 100644 --- a/ui/components/app/asset-list/asset-list.js +++ b/ui/components/app/asset-list/asset-list.js @@ -13,6 +13,7 @@ import { getCurrentAccountWithSendEtherInfo, getShouldShowFiat, getNativeCurrencyImage, + getIsMainnet, } from '../../../selectors'; import { getNativeCurrency } from '../../../ducks/metamask/metamask'; import { useCurrencyDisplay } from '../../../hooks/useCurrencyDisplay'; @@ -75,6 +76,7 @@ const AssetList = ({ onClickAsset }) => { }); const primaryTokenImage = useSelector(getNativeCurrencyImage); + const isMainnet = useSelector(getIsMainnet) || process.env.IN_TEST; return ( <> @@ -106,6 +108,7 @@ const AssetList = ({ onClickAsset }) => { { history.push(IMPORT_TOKEN_ROUTE); addTokenEvent(); diff --git a/ui/components/app/import-token-link/import-token-link.component.js b/ui/components/app/import-token-link/import-token-link.component.js index da616c170..40e153000 100644 --- a/ui/components/app/import-token-link/import-token-link.component.js +++ b/ui/components/app/import-token-link/import-token-link.component.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { useHistory } from 'react-router-dom'; import { useMetricEvent } from '../../../hooks/useMetricEvent'; import { useI18nContext } from '../../../hooks/useI18nContext'; @@ -8,7 +9,7 @@ import Box from '../../ui/box/box'; import { TEXT_ALIGN } from '../../../helpers/constants/design-system'; import { detectNewTokens } from '../../../store/actions'; -export default function ImportTokenLink() { +export default function ImportTokenLink({ isMainnet }) { const addTokenEvent = useMetricEvent({ eventOpts: { category: 'Navigation', @@ -21,14 +22,18 @@ export default function ImportTokenLink() { return ( - - {' or '} + {isMainnet && ( + <> + + {t('or')} + + )} ); } + +ImportTokenLink.propTypes = { + isMainnet: PropTypes.bool, +}; diff --git a/ui/components/app/import-token-link/index.scss b/ui/components/app/import-token-link/index.scss index 83586363a..a0d2a7ea7 100644 --- a/ui/components/app/import-token-link/index.scss +++ b/ui/components/app/import-token-link/index.scss @@ -3,6 +3,6 @@ @include H6; display: inline; - padding: 0 0 16px; + padding: 0 5px 16px; } }