Commit a3a32f0d authored by Charles Bachmeier's avatar Charles Bachmeier Committed by GitHub

fix: add null check to collection floor price (#4528)

* add null check to collection floor price

* don't show 0 if floor is null

* formatEthPrice accepts udnefined
Co-authored-by: default avatarCharlie <charlie@uniswap.org>
parent ee001f86
......@@ -141,7 +141,7 @@ export const SearchBarDropdown = ({ toggleOpen, tokens, collections, hasInput }:
return {
...collection,
collectionAddress: collection.address,
floorPrice: formatEthPrice(collection.floor.toString()),
floorPrice: formatEthPrice(collection.floor?.toString()),
stats: {
total_supply: collection.totalSupply,
one_day_change: collection.floorChange,
......
......@@ -78,14 +78,14 @@ export const CollectionRow = ({ collection, isHovered, setHoveredIndex, toggleOp
<Box className={styles.secondaryText}>{putCommas(collection.stats.total_supply)} items</Box>
</Column>
</Row>
{collection.floorPrice && (
{collection.floorPrice ? (
<Column className={styles.suggestionSecondaryContainer}>
<Row gap="4">
<Box className={styles.primaryText}>{ethNumberStandardFormatter(collection.floorPrice)} ETH</Box>
</Row>
<Box className={styles.secondaryText}>Floor</Box>
</Column>
)}
) : null}
</Link>
)
}
......
......@@ -16,7 +16,7 @@ export const formatUSDPriceWithCommas = (price: number) => {
.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`
}
export const formatEthPrice = (price: string) => {
export const formatEthPrice = (price: string | undefined) => {
if (!price) return 0
const formattedPrice = parseFloat(formatEther(String(price)))
......
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