1
- import React from "react" ;
1
+ import React , { useMemo } from "react" ;
2
2
import styled from "styled-components" ;
3
3
import { useAccount , useDisconnect } from "wagmi" ;
4
4
import { Button } from "@kleros/ui-components-library" ;
@@ -64,13 +64,29 @@ const UserContainer = styled.div`
64
64
gap: 12px;
65
65
` ;
66
66
67
+ const StyledA = styled . a `
68
+ text-decoration: none;
69
+ label {
70
+ cursor: pointer;
71
+ color: ${ ( { theme } ) => theme . primaryBlue } ;
72
+ }
73
+ :hover {
74
+ text-decoration: underline;
75
+ }
76
+ ` ;
77
+
67
78
export const DisconnectWalletButton : React . FC = ( ) => {
68
79
const { disconnect } = useDisconnect ( ) ;
69
80
return < Button text = "Disconnect" onClick = { ( ) => disconnect ( ) } /> ;
70
81
} ;
71
82
72
83
const General : React . FC = ( ) => {
73
- const { address } = useAccount ( ) ;
84
+ const { address, chain } = useAccount ( ) ;
85
+
86
+ const addressExplorerLink = useMemo ( ( ) => {
87
+ return `${ chain ?. blockExplorers ?. default . url } /address/${ address } ` ;
88
+ } , [ address , chain ] ) ;
89
+
74
90
return (
75
91
< EnsureChainContainer >
76
92
< EnsureChain >
@@ -81,7 +97,9 @@ const General: React.FC = () => {
81
97
< IdenticonOrAvatar size = "48" />
82
98
</ StyledAvatarContainer >
83
99
< StyledAddressContainer >
84
- < AddressOrName />
100
+ < StyledA href = { addressExplorerLink } rel = "noreferrer" target = "_blank" >
101
+ < AddressOrName />
102
+ </ StyledA >
85
103
</ StyledAddressContainer >
86
104
< StyledChainContainer >
87
105
< ChainDisplay />
@@ -97,4 +115,4 @@ const General: React.FC = () => {
97
115
) ;
98
116
} ;
99
117
100
- export default General ;
118
+ export default General ;
0 commit comments