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:
parent
c110f92cf6
commit
6809fd44e0
@ -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 ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user