Accommodate for 0 sources verifying swap token (#10521)

feature/default_network_editable
David Walsh 4 years ago committed by GitHub
parent 616b71271a
commit 8013e85c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/_locales/en/messages.json
  2. 16
      ui/app/pages/swaps/build-quote/build-quote.js

@ -1908,6 +1908,9 @@
"message": "Always confirm the token address on $1.", "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." "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": { "swapTokenVerificationOnlyOneSource": {
"message": "Only verified on 1 source." "message": "Only verified on 1 source."
}, },

@ -113,7 +113,7 @@ export default function BuildQuote({
const toTokenIsNotEth = const toTokenIsNotEth =
selectedToToken?.address && selectedToToken?.address &&
selectedToToken?.address !== ETH_SWAPS_TOKEN_OBJECT.address; selectedToToken?.address !== ETH_SWAPS_TOKEN_OBJECT.address;
const occurances = Number(selectedToToken?.occurances || 0);
const { const {
address: fromTokenAddress, address: fromTokenAddress,
symbol: fromTokenSymbol, symbol: fromTokenSymbol,
@ -376,12 +376,14 @@ export default function BuildQuote({
/> />
</div> </div>
{toTokenIsNotEth && {toTokenIsNotEth &&
(selectedToToken.occurances === 1 ? ( (occurances < 2 ? (
<ActionableMessage <ActionableMessage
message={ message={
<div className="build-quote__token-verification-warning-message"> <div className="build-quote__token-verification-warning-message">
<div className="build-quote__bold"> <div className="build-quote__bold">
{t('swapTokenVerificationOnlyOneSource')} {occurances === 1
? t('swapTokenVerificationOnlyOneSource')
: t('swapTokenVerificationNoSource')}
</div> </div>
<div> <div>
{t('verifyThisTokenOn', [ {t('verifyThisTokenOn', [
@ -416,9 +418,7 @@ export default function BuildQuote({
className="build-quote__bold" className="build-quote__bold"
key="token-verification-bold-text" key="token-verification-bold-text"
> >
{t('swapTokenVerificationSources', [ {t('swapTokenVerificationSources', [occurances])}
selectedToToken.occurances,
])}
</span> </span>
{t('swapTokenVerificationMessage', [ {t('swapTokenVerificationMessage', [
<a <a
@ -465,9 +465,7 @@ export default function BuildQuote({
!selectedToToken?.address || !selectedToToken?.address ||
Number(maxSlippage) === 0 || Number(maxSlippage) === 0 ||
Number(maxSlippage) > MAX_ALLOWED_SLIPPAGE || Number(maxSlippage) > MAX_ALLOWED_SLIPPAGE ||
(toTokenIsNotEth && (toTokenIsNotEth && occurances < 2 && !verificationClicked)
selectedToToken.occurances === 1 &&
!verificationClicked)
} }
hideCancel hideCancel
showTermsOfService showTermsOfService

Loading…
Cancel
Save