diff --git a/apps/bridge-dapp/src/hooks/useConnectButtonProps.ts b/apps/bridge-dapp/src/hooks/useConnectButtonProps.ts index ae3afc274e..313c27d469 100644 --- a/apps/bridge-dapp/src/hooks/useConnectButtonProps.ts +++ b/apps/bridge-dapp/src/hooks/useConnectButtonProps.ts @@ -4,9 +4,7 @@ import { WebbError, WebbErrorCodes } from '@webb-tools/dapp-types/WebbError'; import useCurrentTypedChainId from '@webb-tools/react-hooks/useCurrentTypedChainId'; import { useNoteAccount } from '@webb-tools/react-hooks/useNoteAccount'; import { useCallback, useMemo } from 'react'; -import { BRIDGE_PATH, SELECT_SOURCE_CHAIN_PATH } from '../constants'; import { useConnectWallet } from './useConnectWallet'; -import useNavigateWithPersistParams from './useNavigateWithPersistParams'; function useConnectButtonProps(typedChainId?: number | null) { const { activeApi = null, activeWallet, switchChain } = useWebContext(); @@ -17,8 +15,6 @@ function useConnectButtonProps(typedChainId?: number | null) { const activeTypedChainId = useCurrentTypedChainId(); - const navigate = useNavigateWithPersistParams(); - const content = useMemo(() => { if (!activeWallet) { return 'Connect Wallet' as const; @@ -64,7 +60,7 @@ function useConnectButtonProps(typedChainId?: number | null) { if (nextChainSupported) { return switchChain(nextChain, activeWallet); } else { - navigate(`/${BRIDGE_PATH}/${SELECT_SOURCE_CHAIN_PATH}`); + toggleModal(true, typedChainId); return null; } } @@ -87,7 +83,7 @@ function useConnectButtonProps(typedChainId?: number | null) { } }, // prettier-ignore - [activeApi, activeTypedChainId, activeWallet, hasNoteAccount, navigate, setOpenNoteAccountModal, switchChain, toggleModal] + [activeApi, activeTypedChainId, activeWallet, hasNoteAccount, setOpenNoteAccountModal, switchChain, toggleModal] ); return {