Skip to content

Commit d4f28a5

Browse files
committed
fix(web): correct hook use
1 parent 1fd68f0 commit d4f28a5

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

web/src/layout/Header/DesktopHeader.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled, { css } from "styled-components";
33

44
import { useLocation } from "react-router-dom";
55
import { useToggle } from "react-use";
6-
import { useAccount, useChainId } from "wagmi";
6+
import { useAccount } from "wagmi";
77

88
import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg";
99

@@ -75,14 +75,14 @@ const StyledKlerosSolutionsIcon = styled(KlerosSolutionsIcon)`
7575
fill: ${({ theme }) => theme.white} !important;
7676
`;
7777

78-
const ConnectWalletContainer = styled.div<{ isConnected: boolean; isCorrectChain: boolean }>`
78+
const ConnectWalletContainer = styled.div<{ isConnected: boolean; isDefaultChain: boolean }>`
7979
label {
8080
color: ${({ theme }) => theme.white};
8181
}
8282
83-
${({ isConnected, isCorrectChain }) =>
83+
${({ isConnected, isDefaultChain }) =>
8484
isConnected &&
85-
isCorrectChain &&
85+
isDefaultChain &&
8686
css`
8787
cursor: pointer;
8888
& > * {
@@ -108,9 +108,8 @@ const DesktopHeader: React.FC = () => {
108108
const [isOnboardingMiniGuidesOpen, toggleIsOnboardingMiniGuidesOpen] = useToggle(false);
109109
const [initialTab, setInitialTab] = useState<number>(0);
110110
const location = useLocation();
111-
const chainId = useChainId();
112-
const { isConnected } = useAccount();
113-
const isCorrectChain = chainId === DEFAULT_CHAIN;
111+
const { isConnected, chainId } = useAccount();
112+
const isDefaultChain = chainId === DEFAULT_CHAIN;
114113

115114
const initializeFragmentURL = useCallback(() => {
116115
const hash = location.hash;
@@ -147,8 +146,8 @@ const DesktopHeader: React.FC = () => {
147146

148147
<RightSide>
149148
<ConnectWalletContainer
150-
{...{ isConnected, isCorrectChain }}
151-
onClick={isConnected && isCorrectChain ? toggleIsSettingsOpen : undefined}
149+
{...{ isConnected, isDefaultChain }}
150+
onClick={isConnected && isDefaultChain ? toggleIsSettingsOpen : undefined}
152151
>
153152
<ConnectWallet />
154153
</ConnectWalletContainer>

0 commit comments

Comments
 (0)