import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { useCollections } from '@reservoir0x/reservoir-kit-ui' import { OpenSeaVerified } from 'components/common/OpenSeaVerified' import { ActiveMintTooltip } from 'components/home/ActiveMintTooltip' import { NAVBAR_HEIGHT } from 'components/navbar' import { Box, Flex, FormatCryptoCurrency, HeaderRow, TableCell, TableRow, Text, } from 'components/primitives' import Img from 'components/primitives/Img' import { PercentChange } from 'components/primitives/PercentChange' import { useMarketplaceChain } from 'hooks' import Link from 'next/link' import { ComponentPropsWithoutRef, FC, useMemo } from 'react' import { useMediaQuery } from 'react-responsive' import optimizeImage from 'utils/optimizeImage' type Props = { collections: ReturnType['data'] loading?: boolean volumeKey: '1day' | '7day' | '30day' | 'allTime' } const gridColumns = { gridTemplateColumns: '520px repeat(6, 0.5fr) 250px', '@md': { gridTemplateColumns: '420px 1fr 1fr 1fr', }, '@lg': { gridTemplateColumns: '360px repeat(6, 0.5fr) 250px', }, '@xl': { gridTemplateColumns: '520px repeat(6, 0.5fr) 250px', }, } export const CollectionRankingsTable: FC = ({ collections, loading, volumeKey, }) => { const isSmallDevice = useMediaQuery({ maxWidth: 900 }) return ( <> {!loading && collections.length === 0 ? ( No collections found ) : ( {isSmallDevice ? ( Collection Volume ) : ( )} {collections.map((collection, i) => { return ( ) })} )} ) } type RankingsTableRowProps = { collection: ReturnType['data'][0] rank: number volumeKey: ComponentPropsWithoutRef< typeof CollectionRankingsTable >['volumeKey'] } const RankingsTableRow: FC = ({ collection, rank, volumeKey, }) => { const { routePrefix } = useMarketplaceChain() const isSmallDevice = useMediaQuery({ maxWidth: 900 }) const collectionImage = useMemo(() => { return optimizeImage(collection.image as string, 250) }, [collection.image]) const mintData = collection?.mintStages?.find( (stage) => stage.kind === 'public' ) const mintPriceDecimal = mintData?.price?.amount?.decimal const hasMintPriceDecimal = typeof mintPriceDecimal === 'number' if (isSmallDevice) { return ( {rank} Collection Image {collection?.name} {mintData && hasMintPriceDecimal ? : null} Floor {volumeKey !== 'allTime' && ( )} ) } else { return ( {rank} Collection Image {collection?.name} {mintData && hasMintPriceDecimal ? : null} {Number(collection?.tokenCount)?.toLocaleString()} {collection?.sampleImages?.map((image, i) => { if (image) { return ( ) => { e.currentTarget.style.visibility = 'hidden' }} /> ) } return null })} ) } } const headings = [ 'Collection', 'Floor Price', 'Top Offer', 'Volume', '1D Change', '7D Change', 'Supply', 'Sample Tokens', ] const TableHeading = () => ( {headings.map((heading, i) => ( 3} key={heading} css={{ textAlign: i === headings.length - 1 ? 'right' : 'left' }} > {heading} ))} )