Commit b2481d6b authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

fix(asset-details): if an asset has no listings, don't try to render them (#5088)

* fix(asset-details): if an asset has no listings, don't try to render them

* add todo
parent eaa9b519
...@@ -96,7 +96,8 @@ export function useDetailsQuery(address: string, tokenId: string): [GenieAsset, ...@@ -96,7 +96,8 @@ export function useDetailsQuery(address: string, tokenId: string): [GenieAsset,
const asset = queryData.nftAssets?.edges[0]?.node const asset = queryData.nftAssets?.edges[0]?.node
const collection = asset?.collection const collection = asset?.collection
const ethPrice = parseEther(asset?.listings?.edges[0].node.price.value?.toString() ?? '0').toString() const listing = asset?.listings?.edges[0]?.node
const ethPrice = parseEther(listing?.price.value?.toString() ?? '0').toString()
return [ return [
{ {
...@@ -107,7 +108,8 @@ export function useDetailsQuery(address: string, tokenId: string): [GenieAsset, ...@@ -107,7 +108,8 @@ export function useDetailsQuery(address: string, tokenId: string): [GenieAsset,
collectionSymbol: asset?.collection?.image?.url, collectionSymbol: asset?.collection?.image?.url,
imageUrl: asset?.image?.url, imageUrl: asset?.image?.url,
animationUrl: asset?.animationUrl ?? undefined, animationUrl: asset?.animationUrl ?? undefined,
marketplace: asset?.listings?.edges[0]?.node.marketplace.toLowerCase() as any, // todo: fix the back/frontend discrepency here and drop the any
marketplace: listing?.marketplace.toLowerCase() as any,
name: asset?.name ?? undefined, name: asset?.name ?? undefined,
priceInfo: { priceInfo: {
ETHPrice: ethPrice, ETHPrice: ethPrice,
......
...@@ -7,8 +7,13 @@ import { AssetPriceDetails } from 'nft/components/details/AssetPriceDetails' ...@@ -7,8 +7,13 @@ import { AssetPriceDetails } from 'nft/components/details/AssetPriceDetails'
import { Center } from 'nft/components/Flex' import { Center } from 'nft/components/Flex'
import { VerifiedIcon } from 'nft/components/icons' import { VerifiedIcon } from 'nft/components/icons'
import { ActivityFetcher } from 'nft/queries/genie/ActivityFetcher' import { ActivityFetcher } from 'nft/queries/genie/ActivityFetcher'
import { ActivityEventResponse, ActivityEventType } from 'nft/types' import {
import { CollectionInfoForAsset, GenieAsset, GenieCollection } from 'nft/types' ActivityEventResponse,
ActivityEventType,
CollectionInfoForAsset,
GenieAsset,
GenieCollection,
} from 'nft/types'
import { shortenAddress } from 'nft/utils/address' import { shortenAddress } from 'nft/utils/address'
import { formatEthPrice } from 'nft/utils/currency' import { formatEthPrice } from 'nft/utils/currency'
import { isAudio } from 'nft/utils/isAudio' import { isAudio } from 'nft/utils/isAudio'
......
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