fix: divide by zero error on pool page (#6837)
* fix: divide by zero error on pool page * removing changes here * adding price in conditional --------- Co-authored-by: John Short <john.short@CORN-Jack-899.local>
This commit is contained in:
parent
2f84507a23
commit
f290787b99
@ -21,6 +21,11 @@ export function PoolPriceBar({
|
||||
price?: Price<Currency, Currency>
|
||||
}) {
|
||||
const theme = useTheme()
|
||||
const canInvertPrice = Boolean(
|
||||
price && price.baseCurrency && price.quoteCurrency && !price.baseCurrency.equals(price.quoteCurrency)
|
||||
)
|
||||
const invertedPrice = canInvertPrice ? price?.invert()?.toSignificant(6) : undefined
|
||||
|
||||
return (
|
||||
<AutoColumn gap="md">
|
||||
<AutoRow justify="space-around" gap="4px">
|
||||
@ -33,7 +38,7 @@ export function PoolPriceBar({
|
||||
</Text>
|
||||
</AutoColumn>
|
||||
<AutoColumn justify="center">
|
||||
<ThemedText.DeprecatedBlack>{price?.invert()?.toSignificant(6) ?? '-'}</ThemedText.DeprecatedBlack>
|
||||
<ThemedText.DeprecatedBlack>{invertedPrice ?? '-'}</ThemedText.DeprecatedBlack>
|
||||
<Text fontWeight={500} fontSize={14} color={theme.textSecondary} pt={1}>
|
||||
<Trans>
|
||||
{currencies[Field.CURRENCY_A]?.symbol} per {currencies[Field.CURRENCY_B]?.symbol}
|
||||
|
Loading…
Reference in New Issue
Block a user