22import BigNumber from 'bignumber.js' ;
33import React , { Component } from 'react' ;
44import { observer } from 'mobx-react' ;
5- import { Box , Text , Center , Flex } from '@chakra-ui/react' ;
5+ import { Box , Center } from '@chakra-ui/react' ;
66import clockIcon from '../../../assets/images/clock-corner.inline.svg' ;
77import noDataDashBigImage from '../../../assets/images/no-data-dash-big.inline.svg' ;
88import { getColorFromRange , getSaturationColor } from '../../../utils/colors' ;
@@ -11,9 +11,21 @@ import {
1111 IS_RANKING_DATA_AVAILABLE ,
1212 IS_SATURATION_DATA_AVAILABLE ,
1313} from '../../../config/stakingConfig' ;
14- import adaIcon from '../../../assets/images/ada-symbol.inline.svg' ;
1514import { formattedWalletAmount } from '../../../utils/formatters' ;
16- import { AdaIcon , ClockIcon , NoDataDashIcon } from './ThumbPoolContent.styles' ;
15+ import {
16+ ClockIcon ,
17+ NoDataDashIcon ,
18+ Container ,
19+ Ticker ,
20+ Rewards ,
21+ NoDataDash ,
22+ Ranking ,
23+ RankingStar ,
24+ SaturationBar ,
25+ Clock ,
26+ ColorBand ,
27+ GreyColorBand ,
28+ } from './ThumbPoolContent.styles' ;
1729
1830type Props = {
1931 stakePool : StakePool ,
@@ -55,99 +67,54 @@ export default class ThumbPoolContent extends Component<Props> {
5567 const color = getColorFromRange ( ranking , numberOfRankedStakePools ) ;
5668
5769 return (
58- < Flex
59- h = "16"
60- w = "20"
61- flexDirection = "column"
62- pt = { ! IS_SATURATION_DATA_AVAILABLE ? '3' : '2' }
63- pos = "relative"
64- >
70+ < Container >
6571 < Box h = "full" >
66- < Center mb = { ! IS_SATURATION_DATA_AVAILABLE ? '1' : 'px' } >
67- < Text
68- fontWeight = "semibold"
69- fontSize = "sm"
70- sx = { { color : 'var(--theme-staking-stake-pool-ticker-color)' } }
71- lineHeight = "none"
72- >
73- { ticker }
74- </ Text >
75- </ Center >
72+ < Ticker > { ticker } </ Ticker >
7673 { isGridRewardsView &&
7774 ( IS_RANKING_DATA_AVAILABLE && nonMyopicMemberRewards ? (
78- < Center py = "0.5" pos = "relative" flex = "1 1 auto" >
79- < Text fontSize = "sm" fontWeight = "semibold" >
80- { this . formattedRewards ( potentialRewards ) }
81- </ Text >
82- < AdaIcon svg = { adaIcon } />
83- </ Center >
75+ < Rewards > { this . formattedRewards ( potentialRewards ) } </ Rewards >
8476 ) : (
85- < Center flex = "1 1 auto" >
86- < NoDataDashIcon svg = { noDataDashBigImage } />
87- </ Center >
77+ < NoDataDash />
8878 ) ) }
8979 { ! isGridRewardsView &&
9080 ( IS_RANKING_DATA_AVAILABLE ? (
91- < Center flex = "1" style = { { color } } mt = "1" >
92- < Text fontSize = "xl" fontWeight = "bold" lineHeight = "none" >
93- { nonMyopicMemberRewards ? (
94- ranking
95- ) : (
96- < >
97- { numberOfRankedStakePools + 1 }
98- < Text display = "inline-block" > *</ Text >
99- </ >
100- ) }
101- </ Text >
102- </ Center >
81+ < Ranking color = { color } >
82+ { nonMyopicMemberRewards ? (
83+ ranking
84+ ) : (
85+ < >
86+ { numberOfRankedStakePools + 1 }
87+ < RankingStar > *</ RankingStar >
88+ </ >
89+ ) }
90+ </ Ranking >
10391 ) : (
10492 < Center flex = "1 1 auto" >
10593 < NoDataDashIcon svg = { noDataDashBigImage } />
10694 </ Center >
10795 ) ) }
10896 { IS_SATURATION_DATA_AVAILABLE && (
109- < Center my = "1" >
110- < Flex
111- h = "1"
112- w = "10"
113- sx = { {
114- background :
115- 'var(--theme-staking-stake-pool-saturation-background-color)' ,
116- } }
117- borderRadius = "sm"
118- >
119- < Box
120- as = "span"
121- h = "1"
122- sx = { {
123- width : `${ parseFloat ( saturation ) . toFixed ( 2 ) } %` ,
124- } }
125- bg = { `stakePoolSaturation.${ getSaturationColor ( saturation ) } ` }
126- />
127- </ Flex >
128- </ Center >
97+ < SaturationBar
98+ width = { parseFloat ( saturation ) . toFixed ( 2 ) }
99+ color = { getSaturationColor ( saturation ) }
100+ />
129101 ) }
130102 </ Box >
131103 < Box alignSelf = "flex-end" w = "full" >
132104 { IS_RANKING_DATA_AVAILABLE ? (
133105 < >
134106 { retiring && (
135- < Box pos = "absolute" right = "0" top = "0" >
107+ < Clock >
136108 < ClockIcon svg = { clockIcon } />
137- </ Box >
109+ </ Clock >
138110 ) }
139- < Box h = "1" w = "full" sx = { { background : color } } flexShrink = "0" />
111+ < ColorBand color = { color } />
140112 </ >
141113 ) : (
142- < Box
143- h = "1"
144- w = "full"
145- sx = { { background : 'var(--theme-staking-stake-pool-grey-color)' } }
146- flexShrink = "0"
147- />
114+ < GreyColorBand />
148115 ) }
149116 </ Box >
150- </ Flex >
117+ </ Container >
151118 ) ;
152119 }
153120}
0 commit comments