|
|
@ -80,13 +80,13 @@ CurrencyDisplay.prototype.getValueToRender = function ({ selectedToken, conversi |
|
|
|
CurrencyDisplay.prototype.getConvertedValueToRender = function (nonFormattedValue) { |
|
|
|
CurrencyDisplay.prototype.getConvertedValueToRender = function (nonFormattedValue) { |
|
|
|
const { primaryCurrency, convertedCurrency, conversionRate } = this.props |
|
|
|
const { primaryCurrency, convertedCurrency, conversionRate } = this.props |
|
|
|
|
|
|
|
|
|
|
|
if (conversionRate == 0 || conversionRate == null || conversionRate == undefined) { |
|
|
|
if (conversionRate === 0 || conversionRate === null || conversionRate === undefined) { |
|
|
|
if (nonFormattedValue != 0) { |
|
|
|
if (nonFormattedValue !== 0) { |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const convertedValue = conversionUtil(nonFormattedValue, { |
|
|
|
let convertedValue = conversionUtil(nonFormattedValue, { |
|
|
|
fromNumericBase: 'dec', |
|
|
|
fromNumericBase: 'dec', |
|
|
|
fromCurrency: primaryCurrency, |
|
|
|
fromCurrency: primaryCurrency, |
|
|
|
toCurrency: convertedCurrency, |
|
|
|
toCurrency: convertedCurrency, |
|
|
@ -94,7 +94,7 @@ CurrencyDisplay.prototype.getConvertedValueToRender = function (nonFormattedValu |
|
|
|
conversionRate, |
|
|
|
conversionRate, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
convertedValue == Number(convertedValue).toFixed(2) |
|
|
|
convertedValue = Number(convertedValue).toFixed(2) |
|
|
|
const upperCaseCurrencyCode = convertedCurrency.toUpperCase() |
|
|
|
const upperCaseCurrencyCode = convertedCurrency.toUpperCase() |
|
|
|
return currencies.find(currency => currency.code === upperCaseCurrencyCode) |
|
|
|
return currencies.find(currency => currency.code === upperCaseCurrencyCode) |
|
|
|
? currencyFormatter.format(Number(convertedValue), { |
|
|
|
? currencyFormatter.format(Number(convertedValue), { |
|
|
@ -132,9 +132,7 @@ CurrencyDisplay.prototype.render = function () { |
|
|
|
const { |
|
|
|
const { |
|
|
|
className = 'currency-display', |
|
|
|
className = 'currency-display', |
|
|
|
primaryBalanceClassName = 'currency-display__input', |
|
|
|
primaryBalanceClassName = 'currency-display__input', |
|
|
|
convertedBalanceClassName = 'currency-display__converted-value', |
|
|
|
|
|
|
|
primaryCurrency, |
|
|
|
primaryCurrency, |
|
|
|
convertedCurrency, |
|
|
|
|
|
|
|
readOnly = false, |
|
|
|
readOnly = false, |
|
|
|
inError = false, |
|
|
|
inError = false, |
|
|
|
onBlur, |
|
|
|
onBlur, |
|
|
|