@@ -3,11 +3,14 @@ import styled, { css } from "styled-components";
3
3
4
4
import { useLocation } from "react-router-dom" ;
5
5
import { useToggle } from "react-use" ;
6
+ import { useAccount , useChainId } from "wagmi" ;
6
7
7
8
import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg" ;
8
9
9
10
import { useLockOverlayScroll } from "hooks/useLockOverlayScroll" ;
10
11
12
+ import { DEFAULT_CHAIN } from "consts/chains" ;
13
+
11
14
import { landscapeStyle } from "styles/landscapeStyle" ;
12
15
import { responsiveSize } from "styles/responsiveSize" ;
13
16
@@ -21,7 +24,6 @@ import Explore from "./navbar/Explore";
21
24
import Menu from "./navbar/Menu" ;
22
25
import Help from "./navbar/Menu/Help" ;
23
26
import Settings from "./navbar/Menu/Settings" ;
24
- import { useAccount } from "wagmi" ;
25
27
26
28
const Container = styled . div `
27
29
display: none;
@@ -73,13 +75,14 @@ const StyledKlerosSolutionsIcon = styled(KlerosSolutionsIcon)`
73
75
fill: ${ ( { theme } ) => theme . white } !important;
74
76
` ;
75
77
76
- const ConnectWalletContainer = styled . div < { isConnected : boolean } > `
78
+ const ConnectWalletContainer = styled . div < { isConnected : boolean ; isCorrectChain : boolean } > `
77
79
label {
78
80
color: ${ ( { theme } ) => theme . white } ;
79
81
}
80
82
81
- ${ ( { isConnected } ) =>
83
+ ${ ( { isConnected, isCorrectChain } ) =>
82
84
isConnected &&
85
+ isCorrectChain &&
83
86
css `
84
87
cursor: pointer;
85
88
& > * {
@@ -105,7 +108,9 @@ const DesktopHeader: React.FC = () => {
105
108
const [ isOnboardingMiniGuidesOpen , toggleIsOnboardingMiniGuidesOpen ] = useToggle ( false ) ;
106
109
const [ initialTab , setInitialTab ] = useState < number > ( 0 ) ;
107
110
const location = useLocation ( ) ;
111
+ const chainId = useChainId ( ) ;
108
112
const { isConnected } = useAccount ( ) ;
113
+ const isCorrectChain = chainId === DEFAULT_CHAIN ;
109
114
110
115
const initializeFragmentURL = useCallback ( ( ) => {
111
116
const hash = location . hash ;
@@ -141,7 +146,10 @@ const DesktopHeader: React.FC = () => {
141
146
</ MiddleSide >
142
147
143
148
< RightSide >
144
- < ConnectWalletContainer { ...{ isConnected } } onClick = { isConnected ? toggleIsSettingsOpen : undefined } >
149
+ < ConnectWalletContainer
150
+ { ...{ isConnected, isCorrectChain } }
151
+ onClick = { isConnected && isCorrectChain ? toggleIsSettingsOpen : undefined }
152
+ >
145
153
< ConnectWallet />
146
154
</ ConnectWalletContainer >
147
155
< Menu { ...{ toggleIsHelpOpen, toggleIsSettingsOpen } } />
0 commit comments