Commit 800b5e0b authored by Ian Lapham's avatar Ian Lapham Committed by GitHub

fix: fix pricing displays (#3214)

* fix pricing displays

* update rate logic, code clean
parent fc637071
...@@ -23,7 +23,7 @@ interface TokenValueProps { ...@@ -23,7 +23,7 @@ interface TokenValueProps {
function TokenValue({ input, usdc, change }: TokenValueProps) { function TokenValue({ input, usdc, change }: TokenValueProps) {
const percent = useMemo(() => { const percent = useMemo(() => {
if (change) { if (change) {
const percent = (change * 100).toPrecision(3) const percent = change.toPrecision(3)
return change > 0 ? `(+${percent}%)` : `(${percent}%)` return change > 0 ? `(+${percent}%)` : `(${percent}%)`
} }
return undefined return undefined
......
...@@ -46,8 +46,9 @@ function LoadedState({ inputAmount, outputAmount, trade }: LoadedStateProps) { ...@@ -46,8 +46,9 @@ function LoadedState({ inputAmount, outputAmount, trade }: LoadedStateProps) {
const ratio = useMemo(() => { const ratio = useMemo(() => {
const [a, b] = flip ? [outputAmount, inputAmount] : [inputAmount, outputAmount] const [a, b] = flip ? [outputAmount, inputAmount] : [inputAmount, outputAmount]
const priceString = (!flip ? executionPrice : executionPrice?.invert())?.toSignificant(6)
const ratio = `1 ${a.currency.symbol} = ${executionPrice?.toSignificant(6)} ${b.currency.symbol}` const ratio = `1 ${a.currency.symbol} = ${priceString}} ${b.currency.symbol}`
const usdc = !flip const usdc = !flip
? fiatValueInput ? fiatValueInput
? ` ($${fiatValueInput.toSignificant(2)})` ? ` ($${fiatValueInput.toSignificant(2)})`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment