1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

set default values in asset stats (#1733)

This commit is contained in:
EnzoVezzaro 2022-10-10 05:52:57 -04:00 committed by GitHub
parent c110f92cf6
commit 6809fd44e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,14 +1,24 @@
import { useAsset } from '@context/Asset' import { useAsset } from '@context/Asset'
import { useUserPreferences } from '@context/UserPreferences' import { useUserPreferences } from '@context/UserPreferences'
import { formatPrice } from '@shared/Price/PriceUnit' import { formatPrice } from '@shared/Price/PriceUnit'
import React from 'react' import React, { useEffect, useState } from 'react'
import styles from './index.module.css' import styles from './index.module.css'
export default function AssetStats() { export default function AssetStats() {
const { locale } = useUserPreferences() const { locale } = useUserPreferences()
const { asset } = useAsset() const { asset } = useAsset()
const [orders, setOrders] = useState(0)
const [allocated, setAllocated] = useState(0)
useEffect(() => {
if (!asset) return
const { orders, allocated } = asset.stats const { orders, allocated } = asset.stats
setOrders(orders)
setAllocated(allocated)
}, [asset])
return ( return (
<footer className={styles.stats}> <footer className={styles.stats}>
{allocated && allocated > 0 ? ( {allocated && allocated > 0 ? (