From 8013e85c20e82a517e8f4c3d2ad20ee9f360ccf8 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Mon, 1 Mar 2021 09:20:38 -0600 Subject: [PATCH] Accommodate for 0 sources verifying swap token (#10521) --- app/_locales/en/messages.json | 3 +++ ui/app/pages/swaps/build-quote/build-quote.js | 16 +++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 6d51f83ab..4f8e2970a 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -1908,6 +1908,9 @@ "message": "Always confirm the token address on $1.", "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." }, + "swapTokenVerificationNoSource": { + "message": "This token has not been verified." + }, "swapTokenVerificationOnlyOneSource": { "message": "Only verified on 1 source." }, diff --git a/ui/app/pages/swaps/build-quote/build-quote.js b/ui/app/pages/swaps/build-quote/build-quote.js index c1a063681..d71f78ad7 100644 --- a/ui/app/pages/swaps/build-quote/build-quote.js +++ b/ui/app/pages/swaps/build-quote/build-quote.js @@ -113,7 +113,7 @@ export default function BuildQuote({ const toTokenIsNotEth = selectedToToken?.address && selectedToToken?.address !== ETH_SWAPS_TOKEN_OBJECT.address; - + const occurances = Number(selectedToToken?.occurances || 0); const { address: fromTokenAddress, symbol: fromTokenSymbol, @@ -376,12 +376,14 @@ export default function BuildQuote({ /> {toTokenIsNotEth && - (selectedToToken.occurances === 1 ? ( + (occurances < 2 ? (
- {t('swapTokenVerificationOnlyOneSource')} + {occurances === 1 + ? t('swapTokenVerificationOnlyOneSource') + : t('swapTokenVerificationNoSource')}
{t('verifyThisTokenOn', [ @@ -416,9 +418,7 @@ export default function BuildQuote({ className="build-quote__bold" key="token-verification-bold-text" > - {t('swapTokenVerificationSources', [ - selectedToToken.occurances, - ])} + {t('swapTokenVerificationSources', [occurances])} {t('swapTokenVerificationMessage', [ MAX_ALLOWED_SLIPPAGE || - (toTokenIsNotEth && - selectedToToken.occurances === 1 && - !verificationClicked) + (toTokenIsNotEth && occurances < 2 && !verificationClicked) } hideCancel showTermsOfService