Skip to content

Commit 04e799d

Browse files
committed
feat(web): show-coherency-percencentage-instead-of-ratio
1 parent 1c54fec commit 04e799d

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

web/src/pages/Home/TopJurors/Header/Coherency.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Container = styled.div`
1111
display: flex;
1212
font-size: 12px !important;
1313
&::before {
14-
content: "Votes";
14+
content: "Coherency";
1515
}
1616
color: ${({ theme }) => theme.secondaryText};
1717
align-items: center;
@@ -21,15 +21,13 @@ const Container = styled.div`
2121
css`
2222
font-size: 14px !important;
2323
justify-content: center;
24-
&::before {
25-
content: "Coherent Votes";
26-
}
2724
`
2825
)}
2926
`;
3027

3128
const coherentVotesTooltipMsg =
32-
"This is the ratio of coherent votes made by a juror: " +
29+
"This is the percentage of coherent votes made by a juror." +
30+
" Hover to see the ratio of coherent votes : " +
3331
"the number in the left is the number of times where the juror " +
3432
"voted coherently and the number in the right is the total number of times " +
3533
"the juror voted";

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Tooltip } from "@kleros/ui-components-library";
12
import React from "react";
23
import styled from "styled-components";
34

@@ -18,7 +19,13 @@ interface ICoherency {
1819
const Coherency: React.FC<ICoherency> = ({ totalCoherentVotes, totalResolvedVotes }) => {
1920
const coherenceRatio = `${totalCoherentVotes}/${totalResolvedVotes}`;
2021

21-
return <Container>{coherenceRatio}</Container>;
22+
return (
23+
<Container>
24+
<Tooltip text={coherenceRatio}>{getPercent(totalCoherentVotes, totalResolvedVotes)}</Tooltip>
25+
</Container>
26+
);
2227
};
2328

29+
const getPercent = (num: number, den: number): string => `${Math.floor((num * 100) / den)}%`;
30+
2431
export default Coherency;

0 commit comments

Comments
 (0)