@@ -5,10 +5,11 @@ import { IdenticonOrAvatar, AddressOrName } from "components/ConnectWallet/Accou
55import EthIcon from "assets/svgs/icons/eth.svg" ;
66import PnkIcon from "assets/svgs/icons/kleros.svg" ;
77import PixelArt from "pages/Dashboard/JurorInfo/PixelArt" ;
8+ import { getFormattedRewards } from "utils/jurorRewardConfig" ;
89import { getUserLevelData } from "utils/userLevelCalculation" ;
910import { useUserQuery } from "hooks/queries/useUser" ;
1011
11- const Container = styled . div < { id ?: number } > `
12+ const Container = styled . div `
1213 display: flex;
1314 justify-content: space-between;
1415 flex-wrap: wrap;
@@ -17,7 +18,7 @@ const Container = styled.div<{ id?: number }>`
1718 background-color: ${ ( { theme } ) => theme . whiteBackground } ;
1819 padding: 24px;
1920 border 1px solid ${ ( { theme } ) => theme . stroke } ;
20- border-top: ${ ( { id } ) => ( id === 1 ? "" : " none" ) } ;
21+ border-top: none;
2122 align-items: center;
2223
2324 label {
@@ -85,7 +86,7 @@ const JurorTitle = styled.div`
8586
8687 ${ landscapeStyle (
8788 ( ) => css `
88- width: calc(40px + (232 - 40) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
89+ width: calc(40px + (220 - 40) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
8990 gap: 36px;
9091 `
9192 ) }
@@ -98,13 +99,13 @@ const Rewards = styled.div`
9899 label {
99100 font-weight: 600;
100101 }
101- width: 132px ;
102+ width: 164px ;
102103 flex-wrap: wrap;
103104
104105 ${ landscapeStyle (
105106 ( ) =>
106107 css `
107- width: calc(60px + (180 - 60) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
108+ width: calc(60px + (240 - 60) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
108109 `
109110 ) }
110111` ;
@@ -136,28 +137,28 @@ const HowItWorks = styled.div`
136137const StyledIdenticonOrAvatar = styled ( IdenticonOrAvatar ) `` ;
137138
138139interface IJurorCard {
139- id : number ;
140+ rank : number ;
140141 address : `0x${string } `;
142+ coherenceScore : number ;
143+ totalCoherent : number ;
144+ totalResolvedDisputes : number ;
141145}
142146
143- const JurorCard : React . FC < IJurorCard > = ( { id, address } ) => {
144- const ethReward = "11" ;
145- const pnkReward = "30K" ;
146- const coherentVotes = "10/12" ;
147-
147+ const JurorCard : React . FC < IJurorCard > = ( { rank, address, coherenceScore, totalCoherent, totalResolvedDisputes } ) => {
148148 const { data } = useUserQuery ( address ?. toLowerCase ( ) ) ;
149- const totalCoherent = data ?. user ? parseInt ( data ?. user ?. totalCoherent ) : 0 ;
150- const totalResolvedDisputes = data ?. user ? parseInt ( data ?. user ?. totalResolvedDisputes ) : 1 ;
151- // const userLevelData = getUserLevelData(totalCoherent, totalResolvedDisputes);
152- const userLevelData = {
153- level : 4 ,
154- } ;
149+
150+ const coherenceRatio = `${ totalCoherent } /${ totalResolvedDisputes } ` ;
151+ const userLevelData = getUserLevelData ( coherenceScore ) ;
152+
153+ const formattedRewards = getFormattedRewards ( data , { } ) ;
154+ const ethReward = formattedRewards . find ( ( r ) => r . token === "ETH" ) ?. amount ;
155+ const pnkReward = formattedRewards . find ( ( r ) => r . token === "PNK" ) ?. amount ;
155156
156157 return (
157- < Container id = { id } >
158+ < Container >
158159 < PlaceAndTitleAndRewardsAndCoherency >
159160 < JurorPlace >
160- < label > { id } </ label >
161+ < label > { rank } </ label >
161162 </ JurorPlace >
162163 < JurorTitle >
163164 < LogoAndAddress >
@@ -173,7 +174,7 @@ const JurorCard: React.FC<IJurorCard> = ({ id, address }) => {
173174 < StyledIcon as = { PnkIcon } />
174175 </ Rewards >
175176 < Coherency >
176- < label > { coherentVotes } </ label >
177+ < label > { coherenceRatio } </ label >
177178 </ Coherency >
178179 </ PlaceAndTitleAndRewardsAndCoherency >
179180 < HowItWorks >
0 commit comments