Commit eb35d3a2 authored by aballerr's avatar aballerr Committed by GitHub

fix: price range and details screen sizing (#5094)

* adjustments to screen sizing and updating to work better with graphql
parent 87455fc0
...@@ -37,6 +37,9 @@ const detailsQuery = graphql` ...@@ -37,6 +37,9 @@ const detailsQuery = graphql`
name name
isVerified isVerified
numAssets numAssets
twitterName
discordUrl
homepageUrl
image { image {
url url
} }
...@@ -158,6 +161,9 @@ export function useDetailsQuery(address: string, tokenId: string): [GenieAsset, ...@@ -158,6 +161,9 @@ export function useDetailsQuery(address: string, tokenId: string): [GenieAsset,
collectionName: collection?.name ?? undefined, collectionName: collection?.name ?? undefined,
isVerified: collection?.isVerified ?? undefined, isVerified: collection?.isVerified ?? undefined,
totalSupply: collection?.numAssets ?? undefined, totalSupply: collection?.numAssets ?? undefined,
twitterUrl: collection?.twitterName ?? undefined,
discordUrl: collection?.discordUrl ?? undefined,
externalUrl: collection?.homepageUrl ?? undefined,
}, },
] ]
} }
...@@ -405,6 +405,12 @@ export const AssetDetails = ({ asset, collection, collectionStats }: AssetDetail ...@@ -405,6 +405,12 @@ export const AssetDetails = ({ asset, collection, collectionStats }: AssetDetail
[isSuccess, eventsData] [isSuccess, eventsData]
) )
// TODO: remove after switching to graphql
const externalUrl = collection.externalUrl ?? collectionStats?.externalUrl
const twitterUrl = collection.twitterUrl ?? collectionStats?.twitterUrl
const discordUrl = collection.discordUrl ?? collectionStats?.discordUrl
const isVerified = collection.isVerified ?? collectionStats?.isVerified
return ( return (
<Column> <Column>
<MediaContainer> <MediaContainer>
...@@ -423,7 +429,7 @@ export const AssetDetails = ({ asset, collection, collectionStats }: AssetDetail ...@@ -423,7 +429,7 @@ export const AssetDetails = ({ asset, collection, collectionStats }: AssetDetail
</MediaContainer> </MediaContainer>
<DefaultLink to={`/nfts/collection/${asset.address}`}> <DefaultLink to={`/nfts/collection/${asset.address}`}>
<CollectionHeader> <CollectionHeader>
{collection.collectionName} {collectionStats?.isVerified && <VerifiedIcon />} {collection.collectionName} {isVerified && <VerifiedIcon />}
</CollectionHeader> </CollectionHeader>
</DefaultLink> </DefaultLink>
...@@ -508,11 +514,9 @@ export const AssetDetails = ({ asset, collection, collectionStats }: AssetDetail ...@@ -508,11 +514,9 @@ export const AssetDetails = ({ asset, collection, collectionStats }: AssetDetail
<DescriptionText>{collection.collectionDescription}</DescriptionText> <DescriptionText>{collection.collectionDescription}</DescriptionText>
<SocialsContainer> <SocialsContainer>
{collectionStats?.externalUrl && <Resource name="Website" link={`${collectionStats?.externalUrl}`} />} {externalUrl && <Resource name="Website" link={`${externalUrl}`} />}
{collectionStats?.twitterUrl && ( {twitterUrl && <Resource name="Twitter" link={`https://twitter.com/${twitterUrl}`} />}
<Resource name="Twitter" link={`https://twitter.com/${collectionStats?.twitterUrl}`} /> {discordUrl && <Resource name="Discord" link={discordUrl} />}
)}
{collectionStats?.discordUrl && <Resource name="Discord" link={collectionStats?.discordUrl} />}
</SocialsContainer> </SocialsContainer>
</> </>
</InfoContainer> </InfoContainer>
......
...@@ -16,7 +16,17 @@ const AssetContainer = styled.div` ...@@ -16,7 +16,17 @@ const AssetContainer = styled.div`
width: 100%; width: 100%;
justify-content: center; justify-content: center;
gap: 60px; gap: 60px;
padding: 48px 40px 0 40px; padding: 48px 48px 0 48px;
@media (max-width: 960px) {
padding: 40px 40px 0 40px;
}
@media (max-width: 540px) {
padding: 20px 20px 0 20px;
}
@media (max-width: 420px) {
padding: 16px 16px 0 16px;
}
` `
const AssetPriceDetailsContainer = styled.div` const AssetPriceDetailsContainer = styled.div`
......
...@@ -57,6 +57,9 @@ export const CollectionStatsFetcher = async (addressOrName: string, recursive = ...@@ -57,6 +57,9 @@ export const CollectionStatsFetcher = async (addressOrName: string, recursive =
const data = await r.json() const data = await r.json()
const collections = data?.data.map((collection: Record<string, unknown>) => { const collections = data?.data.map((collection: Record<string, unknown>) => {
// @ts-ignore
collection.stats.floor_price = collection.floorPrice
return { return {
...collection, ...collection,
traits: collection.traits && groupBy(collection.traits as unknown[], 'trait_type'), traits: collection.traits && groupBy(collection.traits as unknown[], 'trait_type'),
......
...@@ -26,6 +26,9 @@ export interface CollectionInfoForAsset { ...@@ -26,6 +26,9 @@ export interface CollectionInfoForAsset {
collectionName?: string collectionName?: string
isVerified?: boolean isVerified?: boolean
totalSupply?: number totalSupply?: number
discordUrl?: string
twitterUrl?: string
externalUrl?: string
} }
export type CollectionSort = Record< export type CollectionSort = Record<
......
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