1
1
import React from "react" ;
2
2
import styled , { css } from "styled-components" ;
3
3
4
+ import { landscapeStyle } from "styles/landscapeStyle" ;
5
+ import { responsiveSize } from "styles/responsiveSize" ;
6
+
4
7
import { formatUnits } from "viem" ;
5
8
9
+ import PnkIcon from "svgs/icons/pnk.svg" ;
6
10
import LockerIcon from "svgs/icons/locker.svg" ;
7
11
8
12
import { isUndefined } from "utils/index" ;
9
13
10
- import { landscapeStyle } from "styles/landscapeStyle" ;
11
- import { responsiveSize } from "styles/responsiveSize" ;
12
-
13
14
import NumberDisplay from "components/NumberDisplay" ;
14
15
15
16
const Container = styled . div `
@@ -28,48 +29,72 @@ const Container = styled.div`
28
29
) }
29
30
` ;
30
31
31
- const LockedPnk = styled . div `
32
+ const StakedPnk = styled . div `
32
33
display: flex;
33
- flex-wrap: nowrap;
34
34
gap: 8px;
35
- justify-content: flex-start;
35
+ align-items: center;
36
+ ` ;
36
37
37
- ${ landscapeStyle (
38
- ( ) => css `
39
- align-self: center;
40
- `
41
- ) }
38
+ const LockedPnk = styled . div `
39
+ display: flex;
40
+ gap: 8px;
41
+ align-items: center;
42
42
` ;
43
43
44
44
const StyledTitle = styled . h1 `
45
45
margin-bottom: 0;
46
46
font-size: ${ responsiveSize ( 20 , 24 ) } ;
47
47
` ;
48
48
49
+ const TotalStakeAndLockedPnk = styled . div `
50
+ display: flex;
51
+ flex-direction: row;
52
+ gap: 12px 24px;
53
+ flex-wrap: wrap;
54
+ ` ;
55
+
56
+ const StyledPnkIcon = styled ( PnkIcon ) `
57
+ fill: ${ ( { theme } ) => theme . secondaryPurple } ;
58
+ width: 14px;
59
+ ` ;
60
+
49
61
const StyledLockerIcon = styled ( LockerIcon ) `
50
62
fill: ${ ( { theme } ) => theme . secondaryPurple } ;
51
63
width: 14px;
52
64
` ;
53
65
54
66
interface IHeader {
55
- lockedStake : bigint ;
67
+ totalStake : string ;
68
+ lockedStake : string ;
56
69
}
57
70
58
- const Header : React . FC < IHeader > = ( { lockedStake } ) => {
59
- const formattedLockedStake = ! isUndefined ( lockedStake ) && formatUnits ( lockedStake , 18 ) ;
71
+ const Header : React . FC < IHeader > = ( { totalStake, lockedStake } ) => {
72
+ const formattedTotalStake = formatUnits ( BigInt ( totalStake ) , 18 ) ;
73
+ const formattedLockedStake = formatUnits ( BigInt ( lockedStake ) , 18 ) ;
60
74
61
75
return (
62
76
< Container >
63
77
< StyledTitle > Stakes</ StyledTitle >
64
- { ! isUndefined ( lockedStake ) ? (
65
- < LockedPnk >
66
- < StyledLockerIcon />
67
- < label > Locked Stake: </ label >
68
- < small >
69
- < NumberDisplay value = { formattedLockedStake . toString ( ) } unit = "PNK" />
70
- </ small >
71
- </ LockedPnk >
72
- ) : null }
78
+ < TotalStakeAndLockedPnk >
79
+ { ! isUndefined ( totalStake ) ? (
80
+ < StakedPnk >
81
+ < StyledPnkIcon />
82
+ < label > Total Stake: </ label >
83
+ < small >
84
+ < NumberDisplay value = { formattedTotalStake } unit = "PNK" />
85
+ </ small >
86
+ </ StakedPnk >
87
+ ) : null }
88
+ { ! isUndefined ( lockedStake ) ? (
89
+ < LockedPnk >
90
+ < StyledLockerIcon />
91
+ < label > Locked Stake: </ label >
92
+ < small >
93
+ < NumberDisplay value = { formattedLockedStake } unit = "PNK" />
94
+ </ small >
95
+ </ LockedPnk >
96
+ ) : null }
97
+ </ TotalStakeAndLockedPnk >
73
98
</ Container >
74
99
) ;
75
100
} ;
0 commit comments