@@ -3,8 +3,9 @@ import styled, { css } from "styled-components";
33import { landscapeStyle } from "styles/landscapeStyle" ;
44import { useToggle } from "react-use" ;
55import { Link } from "react-router-dom" ;
6- import { useAccount } from "wagmi" ;
6+ import { useAccount , useNetwork } from "wagmi" ;
77import { useLockOverlayScroll } from "hooks/useLockOverlayScroll" ;
8+ import { DEFAULT_CHAIN } from "consts/chains" ;
89import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg" ;
910import EscrowLogo from "svgs/header/escrow.svg" ;
1011import ConnectWallet from "components/ConnectWallet" ;
@@ -69,13 +70,13 @@ const StyledKlerosSolutionsIcon = styled(KlerosSolutionsIcon)`
6970 fill: ${ ( { theme } ) => theme . white } !important;
7071` ;
7172
72- const ConnectWalletContainer = styled . div < { isConnected : boolean } > `
73+ const ConnectWalletContainer = styled . div < { isConnected : boolean ; isDefaultChain : boolean } > `
7374 label {
7475 color: ${ ( { theme } ) => theme . white } ;
7576 }
7677
77- ${ ( { isConnected } ) =>
78- isConnected &&
78+ ${ ( { isConnected, isDefaultChain } ) =>
79+ isConnected && isDefaultChain &&
7980 css `
8081 cursor : pointer;
8182 & > * {
@@ -88,7 +89,9 @@ const DesktopHeader = () => {
8889 const [ isDappListOpen , toggleIsDappListOpen ] = useToggle ( false ) ;
8990 const [ isHelpOpen , toggleIsHelpOpen ] = useToggle ( false ) ;
9091 const [ isSettingsOpen , toggleIsSettingsOpen ] = useToggle ( false ) ;
92+ const { chain } = useNetwork ( ) ;
9193 const { isConnected } = useAccount ( ) ;
94+ const isDefaultChain = chain ?. id === DEFAULT_CHAIN ;
9295 useLockOverlayScroll ( isDappListOpen || isHelpOpen || isSettingsOpen ) ;
9396
9497 return (
@@ -114,7 +117,7 @@ const DesktopHeader = () => {
114117 </ MiddleSide >
115118
116119 < RightSide >
117- < ConnectWalletContainer { ...{ isConnected} } onClick = { isConnected ? toggleIsSettingsOpen : undefined } >
120+ < ConnectWalletContainer { ...{ isConnected, isDefaultChain } } onClick = { isConnected && isDefaultChain ? toggleIsSettingsOpen : undefined } >
118121 < ConnectWallet />
119122 </ ConnectWalletContainer >
120123 < Menu { ...{ toggleIsHelpOpen, toggleIsSettingsOpen } } />
0 commit comments