Skip to content

Commit 8e45aa7

Browse files
committed
refactor(web): top jurors components modularization
1 parent 7f8be8e commit 8e45aa7

File tree

15 files changed

+465
-346
lines changed

15 files changed

+465
-346
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react";
2+
import styled from "styled-components";
3+
import WithHelpTooltip from "pages/Dashboard/WithHelpTooltip";
4+
5+
const Container = styled.div``;
6+
7+
const coherentVotesTooltipMsg =
8+
"This is the ratio of coherent votes made by a juror: " +
9+
"the number in the left is the number of times where the juror " +
10+
"voted coherently and the number in the right is the total number of times " +
11+
"the juror voted";
12+
13+
const Coherency: React.FC = () => (
14+
<Container>
15+
<WithHelpTooltip place="top" tooltipMsg={coherentVotesTooltipMsg}>
16+
<label> Coherent Votes </label>
17+
</WithHelpTooltip>
18+
</Container>
19+
);
20+
export default Coherency;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from "react";
2+
import styled from "styled-components";
3+
import BookOpenIcon from "tsx:assets/svgs/icons/book-open.svg";
4+
5+
const Container = styled.div`
6+
display: flex;
7+
align-items: center;
8+
gap: 8px;
9+
10+
label {
11+
color: ${({ theme }) => theme.primaryBlue};
12+
}
13+
14+
svg {
15+
path {
16+
fill: ${({ theme }) => theme.primaryBlue};
17+
}
18+
}
19+
`;
20+
21+
const Rewards: React.FC = () => (
22+
<Container>
23+
<BookOpenIcon />
24+
<label> How it works </label>
25+
</Container>
26+
);
27+
export default Rewards;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
5+
const Container = styled.div`
6+
display: flex;
7+
gap: 16px;
8+
align-items: center;
9+
10+
label {
11+
font-weight: 400;
12+
font-size: 14px;
13+
line-height: 19px;
14+
color: ${({ theme }) => theme.secondaryText} !important;
15+
}
16+
17+
${landscapeStyle(
18+
() =>
19+
css`
20+
width: calc(40px + (220 - 40) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
21+
gap: 36px;
22+
`
23+
)}
24+
`;
25+
26+
const JurorTitle: React.FC = () => (
27+
<Container>
28+
<label>Juror</label>
29+
</Container>
30+
);
31+
export default JurorTitle;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
5+
const Container = styled.div`
6+
width: 50%;
7+
8+
label {
9+
&::before {
10+
content: "Ranking";
11+
visibility: visible;
12+
}
13+
}
14+
15+
${landscapeStyle(
16+
() =>
17+
css`
18+
width: calc(16px + (24 - 16) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
19+
20+
label {
21+
&::before {
22+
content: "#";
23+
}
24+
}
25+
`
26+
)}
27+
`;
28+
29+
const Rank: React.FC = () => (
30+
<Container>
31+
<label></label>
32+
</Container>
33+
);
34+
export default Rank;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
import WithHelpTooltip from "pages/Dashboard/WithHelpTooltip";
5+
6+
const Container = styled.div`
7+
${landscapeStyle(
8+
() =>
9+
css`
10+
width: calc(60px + (240 - 60) * (min(max(100vw, 375px), 1250px) - 375px) / 875);
11+
`
12+
)}
13+
`;
14+
15+
const totalRewardsTooltipMsg =
16+
"Users have an economic interest in serving as jurors in Kleros: " +
17+
"collecting the Juror Rewards in exchange for their work. Each juror who " +
18+
"is coherent with the final ruling receive the Juror Rewards composed of " +
19+
"arbitration fees (ETH) + PNK redistribution between jurors.";
20+
21+
const Rewards: React.FC = () => (
22+
<Container>
23+
<WithHelpTooltip place="top" tooltipMsg={totalRewardsTooltipMsg}>
24+
<label> Total Rewards </label>
25+
</WithHelpTooltip>
26+
</Container>
27+
);
28+
export default Rewards;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import React from "react";
2+
import styled, { css } from "styled-components";
3+
import { landscapeStyle } from "styles/landscapeStyle";
4+
import Rank from "./Rank";
5+
import JurorTitle from "./JurorTitle";
6+
import Rewards from "./Rewards";
7+
import Coherency from "./Coherency";
8+
import HowItWorks from "./HowItWorks";
9+
10+
const Container = styled.div`
11+
display: flex;
12+
justify-content: space-between;
13+
width: 100%;
14+
height: 100%;
15+
background-color: ${({ theme }) => theme.lightBlue};
16+
padding: 24px;
17+
border 1px solid ${({ theme }) => theme.stroke};
18+
border-top-left-radius: 3px;
19+
border-top-right-radius: 3px;
20+
flex-wrap: wrap;
21+
22+
${landscapeStyle(
23+
() =>
24+
css`
25+
flex-wrap: nowrap;
26+
gap: 0px;
27+
padding: 18.6px 32px;
28+
`
29+
)}
30+
`;
31+
32+
const PlaceAndTitleAndRewardsAndCoherency = styled.div`
33+
display: flex;
34+
flex-direction: column;
35+
gap: 8px;
36+
37+
${landscapeStyle(
38+
() =>
39+
css`
40+
flex-direction: row;
41+
gap: 32px;
42+
`
43+
)}
44+
`;
45+
46+
const Header: React.FC = () => {
47+
return (
48+
<Container>
49+
<PlaceAndTitleAndRewardsAndCoherency>
50+
<Rank />
51+
<JurorTitle />
52+
<Rewards />
53+
<Coherency />
54+
</PlaceAndTitleAndRewardsAndCoherency>
55+
<HowItWorks />
56+
</Container>
57+
);
58+
};
59+
60+
export default Header;

web/src/pages/Home/TopJurors/JurorCard.tsx

Lines changed: 0 additions & 188 deletions
This file was deleted.

0 commit comments

Comments
 (0)