import { FC, useMemo } from 'react' import { Flex, FormatCryptoCurrency, Text } from '../primitives' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { IconDefinition, faImage, faShoppingCart, faSprout, } from '@fortawesome/free-solid-svg-icons' import { useChainStats, useMarketplaceChain } from 'hooks' import { formatNumber } from 'utils/numbers' type Section = { title: string stat: string | JSX.Element icon: IconDefinition } export const ChainStats = () => { const { data: statsData } = useChainStats() const stats = statsData?.stats?.['7day'] const chain = useMarketplaceChain() const statsSections = useMemo(() => { const sections: Section[] = [ { title: '7d Mints', stat: '-', icon: faSprout, }, { title: '7d Secondary Sales', stat: '-', icon: faShoppingCart, }, { title: '7d Total Volume', stat: '-', icon: faImage, }, ] if (stats) { sections[0].stat = `${ stats.mintCount ? formatNumber(stats.mintCount) : 0 }` sections[1].stat = `${ stats.saleCount ? formatNumber(stats.saleCount) : 0 }` sections[2].stat = ( ) } return sections }, [stats, chain]) return ( {statsSections.map((section, i) => ( {section.title} {section.stat} ))} ) }