-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathJurorLevel.tsx
60 lines (48 loc) · 1.38 KB
/
JurorLevel.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from "react";
import styled, { css } from "styled-components";
import { landscapeStyle } from "styles/landscapeStyle";
import { getUserLevelData } from "utils/userLevelCalculation";
import { getCoherencePercent } from "utils/getCoherencePercent";
import PixelArt from "pages/Profile/JurorCard/BottomContent/PixelArt";
const Container = styled.div`
display: flex;
align-items: center;
gap: 8px;
${landscapeStyle(
() => css`
gap: 16px;
justify-content: end;
`
)}
`;
const StyledLabel = styled.label`
font-size: 12px !important;
&::before {
content: "Lv. ";
}
${landscapeStyle(
() => css`
font-size: 16px !important;
&::before {
content: "Level ";
}
`
)}
`;
interface IJurorLevel {
totalCoherentVotes: string;
totalResolvedVotes: string;
totalResolvedDisputes: string;
}
const JurorLevel: React.FC<IJurorLevel> = ({ totalCoherentVotes, totalResolvedVotes, totalResolvedDisputes }) => {
const coherencePercentage = getCoherencePercent(Number(totalCoherentVotes), Number(totalResolvedVotes));
const userLevelData = getUserLevelData(coherencePercentage, Number(totalResolvedDisputes));
const level = userLevelData.level;
return (
<Container>
<StyledLabel>{level}</StyledLabel>
<PixelArt width="32px" height="32px" level={level} />
</Container>
);
};
export default JurorLevel;