fix: hide price when no amount input (#7379)

* fix: hide price when no amount input

* fix: snapshots
This commit is contained in:
eddie 2023-09-27 10:47:16 -07:00 committed by GitHub
parent 71212f7e32
commit 3bb55c6b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 444 additions and 560 deletions

File diff suppressed because it is too large Load Diff

@ -323,6 +323,8 @@ export function Swap({
[independentField, parsedAmount, showWrap, trade]
)
const showFiatValueInput = Boolean(parsedAmounts[Field.INPUT])
const showFiatValueOutput = Boolean(parsedAmounts[Field.OUTPUT])
const getSingleUnitAmount = (currency?: Currency) => {
if (!currency) return
return CurrencyAmount.fromRawAmount(currency, JSBI.BigInt(10 ** currency.decimals))
@ -641,7 +643,7 @@ export function Swap({
currency={currencies[Field.INPUT] ?? null}
onUserInput={handleTypeInput}
onMax={handleMaxInput}
fiatValue={fiatValueInput}
fiatValue={showFiatValueInput ? fiatValueInput : undefined}
onCurrencySelect={handleInputSelect}
otherCurrency={currencies[Field.OUTPUT]}
showCommonBases
@ -682,7 +684,7 @@ export function Swap({
label={<Trans>You receive</Trans>}
showMaxButton={false}
hideBalance={false}
fiatValue={fiatValueOutput}
fiatValue={showFiatValueOutput ? fiatValueOutput : undefined}
priceImpact={stablecoinPriceImpact}
currency={currencies[Field.OUTPUT] ?? null}
onCurrencySelect={handleOutputSelect}