@@ -3,11 +3,14 @@ import styled, { css } from "styled-components";
33
44import { useLocation } from "react-router-dom" ;
55import { useToggle } from "react-use" ;
6+ import { useAccount , useChainId } from "wagmi" ;
67
78import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg" ;
89
910import { useLockOverlayScroll } from "hooks/useLockOverlayScroll" ;
1011
12+ import { DEFAULT_CHAIN } from "consts/chains" ;
13+
1114import { landscapeStyle } from "styles/landscapeStyle" ;
1215import { responsiveSize } from "styles/responsiveSize" ;
1316
@@ -21,7 +24,6 @@ import Explore from "./navbar/Explore";
2124import Menu from "./navbar/Menu" ;
2225import Help from "./navbar/Menu/Help" ;
2326import Settings from "./navbar/Menu/Settings" ;
24- import { useAccount } from "wagmi" ;
2527
2628const Container = styled . div `
2729 display: none;
@@ -73,13 +75,14 @@ const StyledKlerosSolutionsIcon = styled(KlerosSolutionsIcon)`
7375 fill: ${ ( { theme } ) => theme . white } !important;
7476` ;
7577
76- const ConnectWalletContainer = styled . div < { isConnected : boolean } > `
78+ const ConnectWalletContainer = styled . div < { isConnected : boolean ; isCorrectChain : boolean } > `
7779 label {
7880 color: ${ ( { theme } ) => theme . white } ;
7981 }
8082
81- ${ ( { isConnected } ) =>
83+ ${ ( { isConnected, isCorrectChain } ) =>
8284 isConnected &&
85+ isCorrectChain &&
8386 css `
8487 cursor: pointer;
8588 & > * {
@@ -105,7 +108,9 @@ const DesktopHeader: React.FC = () => {
105108 const [ isOnboardingMiniGuidesOpen , toggleIsOnboardingMiniGuidesOpen ] = useToggle ( false ) ;
106109 const [ initialTab , setInitialTab ] = useState < number > ( 0 ) ;
107110 const location = useLocation ( ) ;
111+ const chainId = useChainId ( ) ;
108112 const { isConnected } = useAccount ( ) ;
113+ const isCorrectChain = chainId === DEFAULT_CHAIN ;
109114
110115 const initializeFragmentURL = useCallback ( ( ) => {
111116 const hash = location . hash ;
@@ -141,7 +146,10 @@ const DesktopHeader: React.FC = () => {
141146 </ MiddleSide >
142147
143148 < RightSide >
144- < ConnectWalletContainer { ...{ isConnected } } onClick = { isConnected ? toggleIsSettingsOpen : undefined } >
149+ < ConnectWalletContainer
150+ { ...{ isConnected, isCorrectChain } }
151+ onClick = { isConnected && isCorrectChain ? toggleIsSettingsOpen : undefined }
152+ >
145153 < ConnectWallet />
146154 </ ConnectWalletContainer >
147155 < Menu { ...{ toggleIsHelpOpen, toggleIsSettingsOpen } } />
0 commit comments