11import React , { ReactNode } from 'react'
22import styled from '@emotion/styled'
3+ import { RewardsStatistics } from '@fluencelabs/deal-ts-clients/dist/dealExplorerClient/types/schemes'
34import { useParams } from 'wouter'
45
56import { InfoOutlineIcon } from '../../assets/icons'
@@ -83,6 +84,60 @@ const Rewards: React.FC<{
8384 )
8485}
8586
87+ const StakerRewards : React . FC < {
88+ title : string
89+ symbol ?: string
90+ decimals ?: number
91+
92+ total : RewardsStatistics
93+ deals : RewardsStatistics
94+ capacityCommitments : RewardsStatistics
95+ } > = ( {
96+ title : mainTitle ,
97+ symbol,
98+ total,
99+ deals,
100+ capacityCommitments,
101+ decimals,
102+ } ) => {
103+ return (
104+ < div >
105+ < Text size = { 24 } > { mainTitle } </ Text >
106+ < Space height = "24px" />
107+ < ParametersStakerRewards >
108+ { [
109+ { record : capacityCommitments , title : 'CCs' } ,
110+ { record : deals , title : 'Deals' } ,
111+ { record : total , title : 'Total' } ,
112+ ] . map ( ( group ) => (
113+ < div key = { group . title } >
114+ < Record
115+ title = { `In vesting / ${ group . title } ` }
116+ balance = { group . record . inVesting }
117+ symbol = { symbol }
118+ decimals = { decimals }
119+ />
120+ < Space height = "32px" />
121+ < Record
122+ title = { `Available to claim / ${ group . title } ` }
123+ balance = { group . record . availableToClaim }
124+ symbol = { symbol }
125+ decimals = { decimals }
126+ />
127+ < Space height = "32px" />
128+ < Record
129+ title = { `Total claimed / ${ group . title } ` }
130+ balance = { group . record . claimed }
131+ symbol = { symbol }
132+ decimals = { decimals }
133+ />
134+ </ div >
135+ ) ) }
136+ </ ParametersStakerRewards >
137+ </ div >
138+ )
139+ }
140+
86141export const CapacityInfo : React . FC = ( ) => {
87142 const params = useParams ( )
88143
@@ -323,7 +378,7 @@ export const CapacityInfo: React.FC = () => {
323378 </ Parameter >
324379 </ ParametersRow >
325380 < Space height = "40px" />
326- < ParametersRow >
381+ < ParametersRewards >
327382 < Rewards
328383 title = "Provider"
329384 symbol = { capacity . collateralToken . symbol }
@@ -332,15 +387,13 @@ export const CapacityInfo: React.FC = () => {
332387 claimed = { capacity . rewards . provider . claimed }
333388 decimals = { Number ( capacity . collateralToken . decimals ) }
334389 />
335- < Rewards
390+ < StakerRewards
336391 title = "Staker"
337392 symbol = { capacity . collateralToken . symbol }
338- inVesting = { capacity . rewards . staker . inVesting }
339- availableToClaim = { capacity . rewards . staker . availableToClaim }
340- claimed = { capacity . rewards . staker . claimed }
341393 decimals = { Number ( capacity . collateralToken . decimals ) }
394+ { ...capacity . rewards . staker }
342395 />
343- </ ParametersRow >
396+ </ ParametersRewards >
344397 < Space height = "80px" />
345398 < ListComputeUnitsTable capacityCommitmentId = { id } />
346399 < Space height = "30px" />
@@ -396,6 +449,18 @@ const ParametersRow = styled.div`
396449 gap: 120px;
397450`
398451
452+ const ParametersRewards = styled . div `
453+ display: grid;
454+ grid-template-columns: 200px 600px;
455+ gap: 120px;
456+ `
457+
458+ const ParametersStakerRewards = styled . div `
459+ display: grid;
460+ grid-template-columns: 1fr 1fr 1fr;
461+ gap: 60px;
462+ `
463+
399464const Parameter = styled . div `
400465 display: flex;
401466 flex-direction: column;
0 commit comments