22import BigNumber from 'bignumber.js' ;
33import React , { Component } from 'react' ;
44import { observer } from 'mobx-react' ;
5- import SVGInline from 'react-svg-inline' ;
6- import classnames from 'classnames' ;
5+ import { Box , Text , Center , Flex } from '@chakra-ui/react' ;
76import clockIcon from '../../../assets/images/clock-corner.inline.svg' ;
87import noDataDashBigImage from '../../../assets/images/no-data-dash-big.inline.svg' ;
9- import styles from './ThumbPoolContent.scss' ;
108import { getColorFromRange , getSaturationColor } from '../../../utils/colors' ;
119import StakePool from '../../../domains/StakePool' ;
1210import {
@@ -15,6 +13,7 @@ import {
1513} from '../../../config/stakingConfig' ;
1614import adaIcon from '../../../assets/images/ada-symbol.inline.svg' ;
1715import { formattedWalletAmount } from '../../../utils/formatters' ;
16+ import { AdaIcon , ClockIcon , NoDataDashIcon } from './ThumbPoolContent.styles' ;
1817
1918type Props = {
2019 stakePool : StakePool ,
@@ -55,74 +54,100 @@ export default class ThumbPoolContent extends Component<Props> {
5554 } = stakePool ;
5655 const color = getColorFromRange ( ranking , numberOfRankedStakePools ) ;
5756
58- const componentClassnames = classnames ( [
59- styles . component ,
60- ! IS_SATURATION_DATA_AVAILABLE ? styles . hideSaturation : null ,
61- ] ) ;
62-
63- const saturationClassnames = classnames ( [
64- styles . saturationBar ,
65- styles [ getSaturationColor ( saturation ) ] ,
66- ] ) ;
67-
6857 return (
69- < div className = { componentClassnames } >
70- < div className = { styles . ticker } > { ticker } </ div >
71- { isGridRewardsView &&
72- ( IS_RANKING_DATA_AVAILABLE && nonMyopicMemberRewards ? (
73- < div className = { styles . rewards } >
74- { this . formattedRewards ( potentialRewards ) }
75- < SVGInline svg = { adaIcon } className = { styles . adaIcon } />
76- </ div >
77- ) : (
78- < div className = { styles . noDataDash } >
79- < SVGInline svg = { noDataDashBigImage } />
80- </ div >
81- ) ) }
82- { ! isGridRewardsView &&
83- ( IS_RANKING_DATA_AVAILABLE ? (
84- < div className = { styles . ranking } style = { { color } } >
85- { nonMyopicMemberRewards ? (
86- ranking
87- ) : (
88- < >
89- { numberOfRankedStakePools + 1 }
90- < sup > *</ sup >
91- </ >
58+ < Flex
59+ h = "16"
60+ w = "20"
61+ flexDirection = "column"
62+ pt = { ! IS_SATURATION_DATA_AVAILABLE ? '3' : '2' }
63+ pos = "relative"
64+ >
65+ < 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 >
76+ { isGridRewardsView &&
77+ ( 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 >
84+ ) : (
85+ < Center flex = "1 1 auto" >
86+ < NoDataDashIcon svg = { noDataDashBigImage } />
87+ </ Center >
88+ ) ) }
89+ { ! isGridRewardsView &&
90+ ( 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 >
103+ ) : (
104+ < Center flex = "1 1 auto" >
105+ < NoDataDashIcon svg = { noDataDashBigImage } />
106+ </ Center >
107+ ) ) }
108+ { 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 >
129+ ) }
130+ </ Box >
131+ < Box alignSelf = "flex-end" w = "full" >
132+ { IS_RANKING_DATA_AVAILABLE ? (
133+ < >
134+ { retiring && (
135+ < Box pos = "absolute" right = "0" top = "0" >
136+ < ClockIcon svg = { clockIcon } />
137+ </ Box >
92138 ) }
93- </ div >
139+ < Box h = "1" w = "full" sx = { { background : color } } flexShrink = "0" />
140+ </ >
94141 ) : (
95- < div className = { styles . noDataDash } >
96- < SVGInline svg = { noDataDashBigImage } />
97- </ div >
98- ) ) }
99- { IS_SATURATION_DATA_AVAILABLE && (
100- < div className = { saturationClassnames } >
101- < span
102- style = { {
103- width : `${ parseFloat ( saturation ) . toFixed ( 2 ) } %` ,
104- } }
105- />
106- </ div >
107- ) }
108- { IS_RANKING_DATA_AVAILABLE ? (
109- < >
110- { retiring && (
111- < div className = { styles . clock } >
112- < SVGInline svg = { clockIcon } className = { styles . clockIcon } />
113- </ div >
114- ) }
115- < div
116- className = { styles . colorBand }
117- style = { {
118- background : color ,
119- } }
142+ < Box
143+ h = "1"
144+ w = "full"
145+ sx = { { background : 'var(--theme-staking-stake-pool-grey-color)' } }
146+ flexShrink = "0"
120147 />
121- </ >
122- ) : (
123- < div className = { styles . greyColorBand } />
124- ) }
125- </ div >
148+ ) }
149+ </ Box >
150+ </ Flex >
126151 ) ;
127152 }
128153}
0 commit comments