Commit f51474b6 authored by Greg Bugyis's avatar Greg Bugyis Committed by GitHub

feat: [Collection Stats] update listings copy and change value to percentage (#4718)

parent 14f01905
...@@ -245,7 +245,10 @@ const StatsItem = ({ children, label, isMobile }: { children: ReactNode; label: ...@@ -245,7 +245,10 @@ const StatsItem = ({ children, label, isMobile }: { children: ReactNode; label:
const StatsRow = ({ stats, isMobile, ...props }: { stats: GenieCollection; isMobile?: boolean } & BoxProps) => { const StatsRow = ({ stats, isMobile, ...props }: { stats: GenieCollection; isMobile?: boolean } & BoxProps) => {
const numOwnersStr = stats.stats ? putCommas(stats.stats.num_owners) : 0 const numOwnersStr = stats.stats ? putCommas(stats.stats.num_owners) : 0
const totalSupplyStr = stats.stats ? putCommas(stats.stats.total_supply) : 0 const totalSupplyStr = stats.stats ? putCommas(stats.stats.total_supply) : 0
const totalListingsStr = stats.stats ? putCommas(stats.stats.total_listings) : 0 const listedPercentageStr =
stats.stats && stats.stats.total_listings > 0
? ((stats.stats.total_listings / stats.stats.total_supply) * 100).toFixed(0)
: 0
const isCollectionStatsLoading = useIsCollectionLoading((state) => state.isCollectionStatsLoading) const isCollectionStatsLoading = useIsCollectionLoading((state) => state.isCollectionStatsLoading)
// round daily volume & floorPrice to 3 decimals or less // round daily volume & floorPrice to 3 decimals or less
...@@ -284,9 +287,9 @@ const StatsRow = ({ stats, isMobile, ...props }: { stats: GenieCollection; isMob ...@@ -284,9 +287,9 @@ const StatsRow = ({ stats, isMobile, ...props }: { stats: GenieCollection; isMob
{totalVolumeStr} ETH {totalVolumeStr} ETH
</StatsItem> </StatsItem>
) : null} ) : null}
{stats.stats?.total_listings ? ( {stats.stats?.total_listings && listedPercentageStr > 0 ? (
<StatsItem label="Listings" isMobile={isMobile ?? false}> <StatsItem label="Listed" isMobile={isMobile ?? false}>
{totalListingsStr} {listedPercentageStr}%
</StatsItem> </StatsItem>
) : null} ) : null}
</Row> </Row>
......
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