Skip to content

Commit ae90c62

Browse files
committed
fix: dashboard-data-and-wallet-connection
1 parent 76a1310 commit ae90c62

File tree

3 files changed

+70
-16
lines changed

3 files changed

+70
-16
lines changed

web/src/context/Web3Provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const { publicClient, webSocketPublicClient } = configureChains(chains, [
2222
]);
2323

2424
const wagmiConfig = createConfig({
25-
autoConnect: false,
25+
autoConnect: true,
2626
connectors: w3mConnectors({ projectId, version: 2, chains }),
2727
publicClient,
2828
webSocketPublicClient,

web/src/pages/Dashboard/JurorInfo/Coherency.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,38 @@ const tooltipMsg =
1818
" using the number of times you have been coherent and the total cases you" +
1919
" have been in.";
2020

21+
const levelTitles = [
22+
{ scoreRange: [0, 20], level: 0, title: "Diogenes" },
23+
{ scoreRange: [20, 40], level: 1, title: "Pythagoras" },
24+
{ scoreRange: [40, 60], level: 2, title: "Socrates" },
25+
{ scoreRange: [60, 80], level: 3, title: "Plato" },
26+
{ scoreRange: [80, 100], level: 4, title: "Aristotle" },
27+
];
28+
2129
const Coherency: React.FC = () => {
2230
const { address } = useAccount();
2331
const { data } = useUserQuery(address?.toLowerCase());
2432
const totalCoherent = parseInt(data?.user?.totalCoherent) ?? 0;
2533
const totalResolvedDisputes = parseInt(data?.user?.totalResolvedDisputes) ?? 1;
2634
const coherencyScore = calculateCoherencyScore(totalCoherent, totalResolvedDisputes);
35+
const roundedCoherencyScore = Math.round(coherencyScore * 100);
36+
37+
const { level, title } =
38+
levelTitles.find(({ scoreRange }) => {
39+
return roundedCoherencyScore >= scoreRange[0] && roundedCoherencyScore < scoreRange[1];
40+
}) || levelTitles[0];
2741

2842
return (
2943
<Container>
30-
<small>Aristotle</small>
31-
<label>Level 4</label>
32-
<CircularProgress progress={(totalCoherent / Math.max(totalResolvedDisputes, 1)) * 100} />
44+
<small>{title}</small>
45+
<label>Level {level}</label>
46+
<CircularProgress
47+
progress={parseFloat(((totalCoherent / Math.max(totalResolvedDisputes, 1)) * 100).toFixed(2))}
48+
/>
3349
<WithHelpTooltip place="left" {...{ tooltipMsg }}>
3450
<label>
3551
Coherency Score:
36-
<small> {coherencyScore.toFixed(3)} </small>
52+
<small> {coherencyScore.toFixed(2)} </small>
3753
</label>
3854
</WithHelpTooltip>
3955
</Container>

web/src/pages/Dashboard/JurorInfo/TokenRewards.tsx

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from "react";
2-
import styled from "styled-components";
3-
import _ETH from "assets/svgs/styled/eth.svg";
4-
import _PNK from "assets/svgs/styled/pnk.svg";
2+
import styled, { css } from "styled-components";
53

64
const RewardContainer = styled.div`
75
display: flex;
@@ -10,16 +8,25 @@ const RewardContainer = styled.div`
108
gap: 8px;
119
`;
1210

13-
const ETH = styled(_ETH)`
14-
stroke: ${({ theme }) => theme.secondaryBlue};
11+
const StyledH1 = styled.h1`
12+
margin: 0;
1513
`;
1614

17-
const PNK = styled(_PNK)`
18-
stroke: ${({ theme }) => theme.secondaryBlue};
15+
const ETHLinearGradientPath = styled.path<{ gradient: string }>`
16+
${({ gradient }) =>
17+
gradient &&
18+
css`
19+
stroke: url(#${gradient});
20+
stroke-width: 0.5;
21+
`}
1922
`;
20-
21-
const StyledH1 = styled.h1`
22-
margin: 0;
23+
const PNKLinearGradientPath = styled.path<{ gradient: string }>`
24+
${({ gradient }) =>
25+
gradient &&
26+
css`
27+
stroke: url(#${gradient});
28+
stroke-width: 0.5;
29+
`}
2330
`;
2431

2532
interface ITokenRewards {
@@ -31,7 +38,38 @@ interface ITokenRewards {
3138
const TokenRewards: React.FC<ITokenRewards> = ({ token, amount, value }) => {
3239
return (
3340
<RewardContainer>
34-
{token === "ETH" ? <ETH /> : <PNK />}
41+
{token === "ETH" ? (
42+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
43+
<ETHLinearGradientPath
44+
gradient="eth"
45+
id="paint0_linear_14360_27088"
46+
d="M9.86602 28.0687L22.923 36.0836V47.1905L9.86602 28.0687ZM23.423 36.0836L36.4799 28.0687L23.423 47.1905V36.0836ZM23.423 16.428V0.930308L36.666 23.7911L23.423 16.428ZM36.8415 24.4607L23.423 32.703V17L36.8415 24.4607ZM22.923 0.929777V16.4279L9.67081 23.7913L22.923 0.929777ZM22.923 32.7032L9.49539 24.4607L22.923 16.9999V32.7032Z"
47+
strokeWidth="0.5"
48+
/>
49+
<defs>
50+
<linearGradient id="eth" x1="23.173" y1="0" x2="23.173" y2="48" gradientUnits="userSpaceOnUse">
51+
<stop stopColor="#6CC5FF" />
52+
<stop offset="1" stopColor="#B45FFF" />
53+
</linearGradient>
54+
</defs>
55+
</svg>
56+
) : (
57+
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
58+
<PNKLinearGradientPath
59+
gradient="pnk"
60+
fill-rule="evenodd"
61+
clip-rule="evenodd"
62+
d="M15.7151 6L35.6632 7.30096L43.9078 25.526L32.6361 42L12.2385 41.132L4 21.1862L15.7151 6ZM16.2222 7.03373L13.1105 22.2033L31.3917 13.6461L16.2222 7.03373ZM31.8965 14.3445L13.3445 23.0284L29.1334 34.8701L31.8965 14.3445ZM28.5319 35.4771L12.9497 23.7905V40.1518L28.5319 35.4771ZM12.1032 38.5872V23.2874L5.18188 21.8302L12.1032 38.5872ZM5.23158 20.9756L12.1974 22.4421L15.1303 8.14394L5.23158 20.9756ZM15.0532 40.4045L31.7195 41.1137L29.2373 36.1493L15.0532 40.4045ZM29.9956 35.773L32.4763 40.7345L41.6905 27.2676L29.9956 35.773ZM41.9695 23.295L35.3631 8.69144L32.9292 13.5593L41.9695 23.295ZM32.2205 13.0839L18.3024 7.01704L34.7186 8.08766L32.2205 13.0839ZM32.7193 14.5773L30.0082 34.7171L42.7892 25.4218L32.7193 14.5773Z"
63+
fill="url(#paint0_linear_14360_27090)"
64+
/>
65+
<defs>
66+
<linearGradient id="pnk" x1="23.9539" y1="6" x2="23.9539" y2="42" gradientUnits="userSpaceOnUse">
67+
<stop stop-color="#6CC5FF" />
68+
<stop offset="1" stop-color="#B45FFF" />
69+
</linearGradient>
70+
</defs>
71+
</svg>
72+
)}
3573
<StyledH1>
3674
{amount} {token}
3775
</StyledH1>

0 commit comments

Comments
 (0)