Skip to content

Commit 7d7f562

Browse files
committed
feat: add juror links in evidence voting history, top jurors leaderboard
1 parent 837797a commit 7d7f562

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

web/src/components/EvidenceCard.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
176176
<BottomShade>
177177
<AccountContainer>
178178
<Identicon size="24" string={sender} />
179-
<StyledA href={addressExplorerLink} rel="noreferrer" target="_blank">
179+
<StyledA href={addressExplorerLink} rel="noopener noreferrer" target="_blank">
180180
<p>{shortenAddress(sender)}</p>
181181
</StyledA>
182182
</AccountContainer>
183-
<StyledA href={transactionExplorerLink} rel="noreferrer" target="_blank">
183+
<StyledA href={transactionExplorerLink} rel="noopener noreferrer" target="_blank">
184184
<Timestamp>{formatDate(Number(timestamp), true)}</Timestamp>
185185
</StyledA>
186186
{fileURI && fileURI !== "-" ? (

web/src/pages/Cases/CaseDetails/Voting/VotesDetails/AccordionTitle.tsx

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from "react";
1+
import React, { useMemo } from "react";
22
import styled, { css } from "styled-components";
33

44
import Identicon from "react-identicons";
55

66
import { Answer } from "context/NewDisputeContext";
7+
import { DEFAULT_CHAIN, getChain } from "consts/chains";
78
import { getVoteChoice } from "utils/getVoteChoice";
89
import { isUndefined } from "utils/index";
910
import { shortenAddress } from "utils/shortenAddress";
@@ -24,11 +25,13 @@ const TitleContainer = styled.div`
2425
`
2526
)}
2627
`;
28+
2729
const AddressContainer = styled.div`
2830
display: flex;
2931
gap: 8px;
3032
align-items: center;
3133
`;
34+
3235
const StyledLabel = styled.label<{ variant?: string }>`
3336
color: ${({ theme, variant }) => (variant ? theme[variant] : theme.primaryText)};
3437
font-size: 16px;
@@ -38,6 +41,16 @@ const StyledSmall = styled.small`
3841
font-size: 16px;
3942
`;
4043

44+
const StyledA = styled.a`
45+
:hover {
46+
text-decoration: underline;
47+
label {
48+
cursor: pointer;
49+
color: ${({ theme }) => theme.primaryBlue};
50+
}
51+
}
52+
`;
53+
4154
const VoteStatus: React.FC<{
4255
choice?: string;
4356
period: string;
@@ -75,11 +88,17 @@ const AccordionTitle: React.FC<{
7588
commited: boolean;
7689
hiddenVotes: boolean;
7790
}> = ({ juror, choice, voteCount, period, answers, isActiveRound, commited, hiddenVotes }) => {
91+
const addressExplorerLink = useMemo(() => {
92+
return `${getChain(DEFAULT_CHAIN)?.blockExplorers?.default.url}/address/${juror}`;
93+
}, [juror]);
94+
7895
return (
7996
<TitleContainer>
8097
<AddressContainer>
8198
<Identicon size="20" string={juror} />
82-
<StyledLabel variant="secondaryText">{shortenAddress(juror)}</StyledLabel>
99+
<StyledA href={addressExplorerLink} rel="noopener noreferrer" target="_blank">
100+
<StyledLabel variant="secondaryText">{shortenAddress(juror)}</StyledLabel>
101+
</StyledA>
83102
</AddressContainer>
84103
<VoteStatus {...{ choice, period, answers, isActiveRound, commited, hiddenVotes }} />
85104
<StyledLabel variant="secondaryPurple">

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

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React from "react";
1+
import React, { useMemo } from "react";
22
import styled from "styled-components";
33

44
import { IdenticonOrAvatar, AddressOrName } from "components/ConnectWallet/AccountDisplay";
5+
import { DEFAULT_CHAIN, getChain } from "consts/chains";
56

67
const Container = styled.div`
78
display: flex;
@@ -19,15 +20,31 @@ const Container = styled.div`
1920
}
2021
`;
2122

23+
const StyledA = styled.a`
24+
:hover {
25+
text-decoration: underline;
26+
label {
27+
cursor: pointer;
28+
color: ${({ theme }) => theme.primaryBlue};
29+
}
30+
}
31+
`;
32+
2233
interface IJurorTitle {
2334
address: string;
2435
}
2536

2637
const JurorTitle: React.FC<IJurorTitle> = ({ address }) => {
38+
const addressExplorerLink = useMemo(() => {
39+
return `${getChain(DEFAULT_CHAIN)?.blockExplorers?.default.url}/address/${address}`;
40+
}, [address]);
41+
2742
return (
2843
<Container>
2944
<IdenticonOrAvatar address={address} />
30-
<AddressOrName address={address} />
45+
<StyledA href={addressExplorerLink} rel="noopener noreferrer" target="_blank">
46+
<AddressOrName address={address} />
47+
</StyledA>
3148
</Container>
3249
);
3350
};

0 commit comments

Comments
 (0)