11import BigNumber from 'bignumber.js' ;
22import React , { Component } from 'react' ;
33import { observer } from 'mobx-react' ;
4- import { Box , Text , Center , Flex } from '@chakra-ui/react' ;
5- // @ts -ignore ts-migrate(2307) FIXME: Cannot find module '../../../assets/images/clock-c ... Remove this comment to see the full error message
4+ import { Box , Center } from '@chakra-ui/react' ;
5+ // @ts -ignore ts-migrate(2307) FIXME: Cannot find module '../../../assets/images/no-data ... Remove this comment to see the full error message
66import clockIcon from '../../../assets/images/clock-corner.inline.svg' ;
77// @ts -ignore ts-migrate(2307) FIXME: Cannot find module '../../../assets/images/no-data... Remove this comment to see the full error message
88import noDataDashBigImage from '../../../assets/images/no-data-dash-big.inline.svg' ;
@@ -13,10 +13,21 @@ import {
1313 IS_RANKING_DATA_AVAILABLE ,
1414 IS_SATURATION_DATA_AVAILABLE ,
1515} from '../../../config/stakingConfig' ;
16- // @ts -ignore ts-migrate(2307) FIXME: Cannot find module '../../../assets/images/ada-sym... Remove this comment to see the full error message
17- import adaIcon from '../../../assets/images/ada-symbol.inline.svg' ;
1816import { formattedWalletAmount } from '../../../utils/formatters' ;
19- import { AdaIcon , ClockIcon , NoDataDashIcon } from './ThumbPoolContent.styles' ;
17+ import {
18+ ClockIcon ,
19+ NoDataDashIcon ,
20+ Container ,
21+ Ticker ,
22+ Rewards ,
23+ NoDataDash ,
24+ Ranking ,
25+ RankingStar ,
26+ SaturationBar ,
27+ Clock ,
28+ ColorBand ,
29+ GreyColorBand ,
30+ } from './ThumbPoolContent.styles' ;
2031
2132type Props = {
2233 stakePool : StakePool ;
@@ -62,100 +73,54 @@ class ThumbPoolContent extends Component<Props> {
6273 const color = getColorFromRange ( ranking , numberOfRankedStakePools ) ;
6374
6475 return (
65- < Flex
66- h = "16"
67- w = "20"
68- flexDirection = "column"
69- pt = { ! IS_SATURATION_DATA_AVAILABLE ? '3' : '2' }
70- pos = "relative"
71- >
76+ < Container >
7277 < Box h = "full" >
73- < Center mb = { ! IS_SATURATION_DATA_AVAILABLE ? '1' : 'px' } >
74- < Text
75- fontWeight = "semibold"
76- fontSize = "sm"
77- sx = { { color : 'var(--theme-staking-stake-pool-ticker-color)' } }
78- lineHeight = "none"
79- >
80- { ticker }
81- </ Text >
82- </ Center >
78+ < Ticker > { ticker } </ Ticker >
8379 { isGridRewardsView &&
8480 ( IS_RANKING_DATA_AVAILABLE && nonMyopicMemberRewards ? (
85- < Center py = "0.5" pos = "relative" flex = "1 1 auto" >
86- < Text fontSize = "sm" fontWeight = "semibold" >
87- { this . formattedRewards ( potentialRewards ) }
88- </ Text >
89- < AdaIcon svg = { adaIcon } />
90- </ Center >
81+ < Rewards > { this . formattedRewards ( potentialRewards ) } </ Rewards >
9182 ) : (
92- < Center flex = "1 1 auto" >
93- < NoDataDashIcon svg = { noDataDashBigImage } />
94- </ Center >
83+ < NoDataDash />
9584 ) ) }
9685 { ! isGridRewardsView &&
9786 ( IS_RANKING_DATA_AVAILABLE ? (
98- < Center flex = "1" style = { { color } } mt = "1" >
99- < Text fontSize = "xl" fontWeight = "bold" lineHeight = "none" >
100- { nonMyopicMemberRewards ? (
101- ranking
102- ) : (
103- < >
104- { numberOfRankedStakePools + 1 }
105- < Text display = "inline-block" > *</ Text >
106- </ >
107- ) }
108- </ Text >
109- </ Center >
87+ < Ranking color = { color } >
88+ { nonMyopicMemberRewards ? (
89+ ranking
90+ ) : (
91+ < >
92+ { numberOfRankedStakePools + 1 }
93+ < RankingStar > *</ RankingStar >
94+ </ >
95+ ) }
96+ </ Ranking >
11097 ) : (
11198 < Center flex = "1 1 auto" >
11299 < NoDataDashIcon svg = { noDataDashBigImage } />
113100 </ Center >
114101 ) ) }
115102 { IS_SATURATION_DATA_AVAILABLE && (
116- < Center my = "1" >
117- < Flex
118- h = "1"
119- w = "10"
120- sx = { {
121- background :
122- 'var(--theme-staking-stake-pool-saturation-background-color)' ,
123- } }
124- borderRadius = "sm"
125- >
126- < Box
127- as = "span"
128- h = "1"
129- sx = { {
130- // @ts -ignore ts-migrate(2345) FIXME: Argument of type 'number' is not assignable to par... Remove this comment to see the full error message
131- width : `${ parseFloat ( saturation ) . toFixed ( 2 ) } %` ,
132- } }
133- bg = { `stakePoolSaturation.${ getSaturationColor ( saturation ) } ` }
134- />
135- </ Flex >
136- </ Center >
103+ < SaturationBar
104+ width = { parseFloat ( saturation ) . toFixed ( 2 ) }
105+ color = { getSaturationColor ( saturation ) }
106+ />
137107 ) }
138108 </ Box >
139109 < Box alignSelf = "flex-end" w = "full" >
140110 { IS_RANKING_DATA_AVAILABLE ? (
141111 < >
142112 { retiring && (
143- < Box pos = "absolute" right = "0" top = "0" >
113+ < Clock >
144114 < ClockIcon svg = { clockIcon } />
145- </ Box >
115+ </ Clock >
146116 ) }
147- < Box h = "1" w = "full" sx = { { background : color } } flexShrink = "0" />
117+ < ColorBand color = { color } />
148118 </ >
149119 ) : (
150- < Box
151- h = "1"
152- w = "full"
153- sx = { { background : 'var(--theme-staking-stake-pool-grey-color)' } }
154- flexShrink = "0"
155- />
120+ < GreyColorBand />
156121 ) }
157122 </ Box >
158- </ Flex >
123+ </ Container >
159124 ) ;
160125 }
161126}
0 commit comments