File tree 1 file changed +10
-1
lines changed
components/trade/overviewModal
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 45
45
<script setup lang="ts">
46
46
import { useIsTradeOverview } from ' ./utils'
47
47
import { formatToNow } from ' @/utils/format/time'
48
+ import { blank } from ' @/components/collection/activity/events/eventRow/common'
48
49
import { type TradeNftItem } from ' @/components/trade/types'
49
50
import type { NFT } from ' @/types'
50
51
@@ -57,14 +58,22 @@ const { decimals, chainSymbol } = useChain()
57
58
const { isMyTrade, isIncomingTrade } = useIsTradeOverview (computed (() => props .trade ))
58
59
59
60
const getFormattedDifference = (a : number , b : number ) => {
61
+ if (b === 0 && a === 0 ) {
62
+ return blank
63
+ }
64
+
65
+ if (b === 0 && a > 0 ) {
66
+ return ' +100%'
67
+ }
68
+
60
69
const diff = ((b - a ) / b ) * 100
61
70
62
71
return diff > 0
63
72
? ` -${diff .toFixed ()}% `
64
73
: ` +${Math .abs (diff ).toFixed ()}% `
65
74
}
66
75
67
- const floorPrice = computed (() => Number (props .desired ?.collection .floorPrice [0 ].price ) || 0 )
76
+ const floorPrice = computed (() => Number (props .desired ?.collection .floorPrice [0 ]? .price ) || 0 )
68
77
const diff = computed (() => getFormattedDifference (Number (props .trade .price || 0 ), floorPrice .value ))
69
78
70
79
const { formatted : formmatedOffer, usd : offerUsd } = useAmount (
You can’t perform that action at this time.
0 commit comments