@@ -22,14 +22,18 @@ const DashboardInfoContainer: React.FC = () => {
2222 const { breakpoint } = useWindowSize ( ) ;
2323 const { isLoading : isLoadingCommon } = useLoading ( ) ;
2424
25- const { data : tokenData , isFetched : isFetchedDashboardToken } = useGetDashboardToken ( ) ;
26- const convertedTokenData = React . useMemo ( ( ) => {
27- return ExploreDashboardConverter . convertDashboardToken ( tokenData ) ;
28- } , [ tokenData ] ) ;
25+ const { data : dashboardTokenData , isFetched : isFetchedDashboardToken } = useGetDashboardToken ( ) ;
26+ const convertedDashboardTokenData = React . useMemo ( ( ) => {
27+ return ExploreDashboardConverter . convertDashboardToken ( dashboardTokenData ) ;
28+ } , [ dashboardTokenData ] ) ;
2929
3030 const { data : governanceOverview = null , isFetched : isFetchedGovernanceOverview } =
3131 useGetDashboardGovernanceOverview ( ) ;
3232
33+ const convertedGovernanceOverview = React . useMemo ( ( ) => {
34+ return ExploreDashboardConverter . convertGovernanceOverview ( governanceOverview ) ;
35+ } , [ governanceOverview ] ) ;
36+
3337 const isLoading = useMemo ( ( ) => {
3438 if ( isLoadingCommon ) {
3539 return true ;
@@ -39,23 +43,23 @@ const DashboardInfoContainer: React.FC = () => {
3943 } , [ isFetchedDashboardToken , isFetchedGovernanceOverview , isLoadingCommon ] ) ;
4044
4145 const progressBar = useMemo ( ( ) => {
42- if ( ! convertedTokenData ) return "0%" ;
43- const circSupply = Number ( convertedTokenData ?. gnsCirculatingSupply ) ;
44- const totalSupply = Number ( convertedTokenData ?. gnsTotalSupply ) ;
46+ if ( ! convertedDashboardTokenData ) return "0%" ;
47+ const circSupply = Number ( convertedDashboardTokenData ?. gnsCirculatingSupply ) ;
48+ const totalSupply = Number ( convertedDashboardTokenData ?. gnsTotalSupply ) ;
4549 if ( totalSupply === 0 ) return "0%" ;
4650 const percent = Math . min ( ( circSupply / totalSupply ) * 100 , 100 ) ;
4751 return `${ percent } %` ;
48- } , [ convertedTokenData ] ) ;
52+ } , [ convertedDashboardTokenData ] ) ;
4953 const stakingRatio = useMemo ( ( ) => {
50- if ( ! convertedTokenData ) return "-" ;
51- const circSupply = Number ( convertedTokenData ?. gnsCirculatingSupply ) ;
52- const totalStaked = Number ( convertedTokenData ?. gnsTotalStaked ) ;
54+ if ( ! convertedDashboardTokenData ) return "-" ;
55+ const circSupply = Number ( convertedDashboardTokenData ?. gnsCirculatingSupply ) ;
56+ const totalStaked = Number ( convertedDashboardTokenData ?. gnsTotalStaked ) ;
5357
5458 if ( totalStaked === 0 || circSupply === 0 ) return "0%" ;
5559 if ( ( totalStaked * 100 ) / circSupply < 0.01 ) return "<0.01%" ;
5660 const ratio = ( ( totalStaked / circSupply ) * 100 ) . toFixed ( 3 ) ;
5761 return `${ ratio } %` ;
58- } , [ convertedTokenData ] ) ;
62+ } , [ convertedDashboardTokenData ] ) ;
5963
6064 const supplyOverviewInfo : SupplyOverviewInfo = useMemo ( ( ) => {
6165 const DISTRIBUTION_RATIOS = {
@@ -64,10 +68,10 @@ const DashboardInfoContainer: React.FC = () => {
6468 COMMUNITY : 0.05 , // 5%
6569 } ;
6670
67- const circulatingSupply = convertedTokenData . gnsCirculatingSupply ;
68- const totalSupply = convertedTokenData . gnsTotalSupply ;
69- const totalStaked = Number ( convertedTokenData . gnsTotalStaked ) ;
70- const dailyBlockEmissions = Number ( convertedTokenData . gnsDailyBlockEmissions ) ;
71+ const circulatingSupply = convertedDashboardTokenData . gnsCirculatingSupply ;
72+ const totalSupply = convertedDashboardTokenData . gnsTotalSupply ;
73+ const totalStaked = Number ( convertedDashboardTokenData . gnsTotalStaked ) ;
74+ const dailyBlockEmissions = Number ( convertedDashboardTokenData . gnsDailyBlockEmissions ) ;
7175
7276 const emissionDistribution = {
7377 liquidityStaking : dailyBlockEmissions * DISTRIBUTION_RATIOS . LIQUIDITY_STAKING ,
@@ -95,31 +99,31 @@ const DashboardInfoContainer: React.FC = () => {
9599 community : formatOtherPrice ( Math . floor ( emissionDistribution . community ) , { isKMB : false , usd : false } ) ,
96100 } ,
97101 } ;
98- } , [ tokenData , progressBar , stakingRatio ] ) ;
102+ } , [ dashboardTokenData , progressBar , stakingRatio ] ) ;
99103
100104 const governanceOverviewInfo = useMemo ( ( ) => {
101- if ( ! governanceOverview ) {
105+ if ( ! convertedGovernanceOverview ) {
102106 return null ;
103107 }
104108
105109 return {
106- totalDelegated : `${ numberToFormat ( governanceOverview . totalDelegated ) } ${ XGNS_TOKEN . symbol } ` ,
107- holders : `${ numberToFormat ( governanceOverview . holders ) } ` ,
108- passedCount : `${ numberToFormat ( governanceOverview . passedCount ) } ` ,
109- activeCount : `${ numberToFormat ( governanceOverview . activeCount ) } ` ,
110- communityPool : `${ formatOtherPrice ( governanceOverview . communityPool , {
110+ totalDelegated : `${ numberToFormat ( convertedGovernanceOverview . totalDelegated ) } ${ XGNS_TOKEN . symbol } ` ,
111+ holders : `${ numberToFormat ( convertedGovernanceOverview . holders ) } ` ,
112+ passedCount : `${ numberToFormat ( convertedGovernanceOverview . passedCount ) } ` ,
113+ activeCount : `${ numberToFormat ( convertedGovernanceOverview . activeCount ) } ` ,
114+ communityPool : `${ formatOtherPrice ( convertedGovernanceOverview . communityPool , {
111115 isKMB : false ,
112116 } ) } `,
113117 } ;
114- } , [ governanceOverview ] ) ;
118+ } , [ convertedGovernanceOverview ] ) ;
115119
116120 return (
117121 < DashboardInfo
118122 dashboardTokenInfo = { {
119- gnosAmount : formatPrice ( tokenData ?. gnsPrice , {
123+ gnosAmount : formatPrice ( dashboardTokenData ?. gnsPrice , {
120124 isKMB : false ,
121125 } ) ,
122- gnotAmount : formatPrice ( tokenData ?. gnotPrice ?? "0" , {
126+ gnotAmount : formatPrice ( dashboardTokenData ?. gnotPrice ?? "0" , {
123127 isKMB : false ,
124128 } ) ,
125129 } }
0 commit comments