1
- import React from "react" ;
1
+ import React , { useMemo } from "react" ;
2
2
import styled , { css } from "styled-components" ;
3
3
4
4
import Identicon from "react-identicons" ;
5
5
6
6
import { Answer } from "context/NewDisputeContext" ;
7
+ import { DEFAULT_CHAIN , getChain } from "consts/chains" ;
7
8
import { getVoteChoice } from "utils/getVoteChoice" ;
8
9
import { isUndefined } from "utils/index" ;
9
10
import { shortenAddress } from "utils/shortenAddress" ;
@@ -24,11 +25,13 @@ const TitleContainer = styled.div`
24
25
`
25
26
) }
26
27
` ;
28
+
27
29
const AddressContainer = styled . div `
28
30
display: flex;
29
31
gap: 8px;
30
32
align-items: center;
31
33
` ;
34
+
32
35
const StyledLabel = styled . label < { variant ?: string } > `
33
36
color: ${ ( { theme, variant } ) => ( variant ? theme [ variant ] : theme . primaryText ) } ;
34
37
font-size: 16px;
@@ -38,6 +41,16 @@ const StyledSmall = styled.small`
38
41
font-size: 16px;
39
42
` ;
40
43
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
+
41
54
const VoteStatus : React . FC < {
42
55
choice ?: string ;
43
56
period : string ;
@@ -75,11 +88,17 @@ const AccordionTitle: React.FC<{
75
88
commited : boolean ;
76
89
hiddenVotes : boolean ;
77
90
} > = ( { 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
+
78
95
return (
79
96
< TitleContainer >
80
97
< AddressContainer >
81
98
< 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 >
83
102
</ AddressContainer >
84
103
< VoteStatus { ...{ choice, period, answers, isActiveRound, commited, hiddenVotes } } />
85
104
< StyledLabel variant = "secondaryPurple" >
0 commit comments