11import { ChartTypeEnum } from '@/components/chart/chart-type' ;
2+ import config from '@/config' ;
23import React , { useCallback , useEffect , useRef , useState } from 'react' ;
34import ReactDOM from 'react-dom' ;
45
@@ -14,6 +15,23 @@ type UseCustomTooltipProps = {
1415 labelKey : string ;
1516} ;
1617
18+ const EpochLabel : React . FC < {
19+ children : React . ReactNode ;
20+ epoch : number ;
21+ } > = ( { children, epoch } ) => {
22+ const onEpoch = epoch - config . epochDiff ;
23+ return (
24+ < div >
25+ < div >
26+ { onEpoch < 1 ? < span > ON Testing Phase</ span > : < span > ON Epoch { onEpoch . toLocaleString ( ) } </ span > }
27+ :
28+ < span > { children } </ span >
29+ </ div >
30+ < div className = "text10 textSecondary" > Unix epoch { epoch . toLocaleString ( ) } </ div >
31+ </ div >
32+ ) ;
33+ } ;
34+
1735const RechartsTooltipContent = ( { active, payload, label, cardIdRef, setTooltipInfo, mousePositionRef } : any ) => {
1836 const prevActiveRef = useRef ( active ) ;
1937 const prevPayloadRef = useRef ( payload ) ;
@@ -88,7 +106,7 @@ export const useCustomTooltip = ({ chartType, labelKey }: UseCustomTooltipProps)
88106 mousePositionRef = { mousePositionRef }
89107 />
90108 ) ,
91- [ cardIdRef , setTooltipInfo , mousePositionRef ]
109+ [ ]
92110 ) ;
93111
94112 const renderTooltipPortal = useCallback ( ( ) => {
@@ -137,9 +155,9 @@ export const useCustomTooltip = ({ chartType, labelKey }: UseCustomTooltipProps)
137155 tooltipContent = null ;
138156 } else {
139157 tooltipContent = (
140- < div >
141- Epoch { label } : { Number ( value ) . toLocaleString ( ) } jobs
142- </ div >
158+ < EpochLabel epoch = { Number ( label ) } >
159+ < strong > { Number ( value ) . toLocaleString ( ) } </ strong > jobs
160+ </ EpochLabel >
143161 ) ;
144162 }
145163 break ;
@@ -149,9 +167,9 @@ export const useCustomTooltip = ({ chartType, labelKey }: UseCustomTooltipProps)
149167 tooltipContent = null ;
150168 } else {
151169 tooltipContent = (
152- < div >
153- Epoch { label } : USDC { Number ( value ) . toLocaleString ( ) }
154- </ div >
170+ < EpochLabel epoch = { Number ( label ) } >
171+ USDC < strong > { Number ( value ) . toLocaleString ( ) } </ strong >
172+ </ EpochLabel >
155173 ) ;
156174 }
157175 break ;
0 commit comments