|
2 | 2 | import BigNumber from 'bignumber.js'; |
3 | 3 | import React, { Component } from 'react'; |
4 | 4 | import { observer } from 'mobx-react'; |
5 | | -import { Box, Center } from '@chakra-ui/react'; |
| 5 | +import SVGInline from 'react-svg-inline'; |
| 6 | +import classnames from 'classnames'; |
6 | 7 | import clockIcon from '../../../assets/images/clock-corner.inline.svg'; |
7 | 8 | import noDataDashBigImage from '../../../assets/images/no-data-dash-big.inline.svg'; |
| 9 | +import styles from './ThumbPoolContent.scss'; |
8 | 10 | import { getColorFromRange, getSaturationColor } from '../../../utils/colors'; |
9 | 11 | import StakePool from '../../../domains/StakePool'; |
10 | 12 | import { |
11 | 13 | IS_RANKING_DATA_AVAILABLE, |
12 | 14 | IS_SATURATION_DATA_AVAILABLE, |
13 | 15 | } from '../../../config/stakingConfig'; |
| 16 | +import adaIcon from '../../../assets/images/ada-symbol.inline.svg'; |
14 | 17 | import { formattedWalletAmount } from '../../../utils/formatters'; |
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'; |
29 | 18 |
|
30 | 19 | type Props = { |
31 | 20 | stakePool: StakePool, |
@@ -66,55 +55,74 @@ export default class ThumbPoolContent extends Component<Props> { |
66 | 55 | } = stakePool; |
67 | 56 | const color = getColorFromRange(ranking, numberOfRankedStakePools); |
68 | 57 |
|
| 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 | + |
69 | 68 | return ( |
70 | | - <Container> |
71 | | - <Box h="full"> |
72 | | - <Ticker>{ticker}</Ticker> |
73 | | - {isGridRewardsView && |
74 | | - (IS_RANKING_DATA_AVAILABLE && nonMyopicMemberRewards ? ( |
75 | | - <Rewards>{this.formattedRewards(potentialRewards)}</Rewards> |
76 | | - ) : ( |
77 | | - <NoDataDash /> |
78 | | - ))} |
79 | | - {!isGridRewardsView && |
80 | | - (IS_RANKING_DATA_AVAILABLE ? ( |
81 | | - <Ranking color={color}> |
82 | | - {nonMyopicMemberRewards ? ( |
83 | | - ranking |
84 | | - ) : ( |
85 | | - <> |
86 | | - {numberOfRankedStakePools + 1} |
87 | | - <RankingStar>*</RankingStar> |
88 | | - </> |
89 | | - )} |
90 | | - </Ranking> |
91 | | - ) : ( |
92 | | - <Center flex="1 1 auto"> |
93 | | - <NoDataDashIcon svg={noDataDashBigImage} /> |
94 | | - </Center> |
95 | | - ))} |
96 | | - {IS_SATURATION_DATA_AVAILABLE && ( |
97 | | - <SaturationBar |
98 | | - width={parseFloat(saturation).toFixed(2)} |
99 | | - color={getSaturationColor(saturation)} |
100 | | - /> |
101 | | - )} |
102 | | - </Box> |
103 | | - <Box alignSelf="flex-end" w="full"> |
104 | | - {IS_RANKING_DATA_AVAILABLE ? ( |
105 | | - <> |
106 | | - {retiring && ( |
107 | | - <Clock> |
108 | | - <ClockIcon svg={clockIcon} /> |
109 | | - </Clock> |
| 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 | + </> |
110 | 92 | )} |
111 | | - <ColorBand color={color} /> |
112 | | - </> |
| 93 | + </div> |
113 | 94 | ) : ( |
114 | | - <GreyColorBand /> |
115 | | - )} |
116 | | - </Box> |
117 | | - </Container> |
| 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 | + }} |
| 120 | + /> |
| 121 | + </> |
| 122 | + ) : ( |
| 123 | + <div className={styles.greyColorBand} /> |
| 124 | + )} |
| 125 | + </div> |
118 | 126 | ); |
119 | 127 | } |
120 | 128 | } |
0 commit comments