1
- import { Spinner } from "components/spinner" ;
2
1
import dynamic from "next/dynamic" ;
3
2
import React from "react" ;
3
+ import { BsDatabaseX } from "react-icons/bs" ;
4
+ import { SmallFont } from "../../../../../components/fonts" ;
4
5
import { useChains } from "../../context-manager" ;
5
6
import { getChainName } from "../../utils" ;
6
7
import { BoxTitle } from "../box-title" ;
@@ -12,9 +13,13 @@ const EChart = dynamic(() => import("../../../../../lib/echart/line"), {
12
13
export const LeftBox = ( ) => {
13
14
const { chain, pairs } = useChains ( ) ;
14
15
const chainName = getChainName ( pairs ?. [ 0 ] ?. pair ?. blockchain ) ;
16
+ const isValidData =
17
+ chain ?. volume_history ?. length &&
18
+ chain ?. volume_history ?. [ chain ?. volume_history ?. length - 1 || 0 ] ?. [ 1 ] ;
19
+
15
20
const titleInfo = {
16
21
value : chain ?. volume_history ?. [ chain ?. volume_history ?. length - 1 ] ?. [ 1 ] ,
17
- dollar : true ,
22
+ dollar : isValidData ? true : false ,
18
23
percentage : chain ?. volume_change_24h ,
19
24
title : `${ chainName } DeFi Volume` ,
20
25
} ;
@@ -25,7 +30,7 @@ export const LeftBox = () => {
25
30
min-w-[407px] md:min-w-full w-[31.5%] mr-2.5 lg:w-full transition duration-500 md:overflow-visible py-2.5"
26
31
>
27
32
< BoxTitle data = { titleInfo } />
28
- { chain ?. volume_history ?. length > 0 ? (
33
+ { isValidData > 0 ? (
29
34
< div className = "w-[95%] mx-auto h-[210px] lg:h-[190px] -mt-[40px]" >
30
35
< EChart
31
36
data = { chain ?. volume_history || [ ] }
@@ -36,8 +41,9 @@ export const LeftBox = () => {
36
41
/>
37
42
</ div >
38
43
) : (
39
- < div className = "h-[200px] w-full flex items-center justify-center" >
40
- < Spinner extraCss = "w-[30px] h-[30px]" />
44
+ < div className = "h-[200px] w-full flex items-center flex-col justify-center" >
45
+ < BsDatabaseX className = "text-light-font-100 dark:text-dark-font-100 text-2xl mb-2.5" />
46
+ < SmallFont > No data available</ SmallFont >
41
47
</ div >
42
48
) }
43
49
</ div >
0 commit comments