From 0923b9e2c8ec565838e328fbe2fd2a300a7ac007 Mon Sep 17 00:00:00 2001 From: aeddaqqa Date: Tue, 17 Sep 2024 11:19:17 +0100 Subject: [PATCH] fix(partnerConfig): add init after checking for selected network --- src/helpers/useSmartContract.tsx | 2 +- src/layout/PartnersLayout.tsx | 8 +++++++- src/views/settings/Links.tsx | 27 +++++++++++++++------------ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/helpers/useSmartContract.tsx b/src/helpers/useSmartContract.tsx index 305d61ec..d1022d0a 100644 --- a/src/helpers/useSmartContract.tsx +++ b/src/helpers/useSmartContract.tsx @@ -157,7 +157,7 @@ export const SmartContractProvider: React.FC = ({ ch const activeNetwork = useAppSelector(getActiveNetwork) useEffect(() => { - if (auth) initializeEthers() + if (auth && activeNetwork.name.toLowerCase() === 'columbus') initializeEthers() }, [activeNetwork, auth]) useEffect(() => { diff --git a/src/layout/PartnersLayout.tsx b/src/layout/PartnersLayout.tsx index 534a220a..2e98989c 100644 --- a/src/layout/PartnersLayout.tsx +++ b/src/layout/PartnersLayout.tsx @@ -9,6 +9,7 @@ import { SmartContractProvider } from '../helpers/useSmartContract' import { useAppSelector } from '../hooks/reduxHooks' import { useIsPartnerQuery } from '../redux/services/partners' import { getWalletName } from '../redux/slices/app-config' +import { getActiveNetwork } from '../redux/slices/network' import Links from '../views/settings/Links' const ClaimProfile = () => { @@ -57,8 +58,13 @@ const PartnersLayout = () => { navigate('/') } }, [walletName]) + const activeNetwork = useAppSelector(getActiveNetwork) if (isLoading) return <> - if (path.includes('partners/messenger-configuration') && !store.state.isAuth) { + if ( + path.includes('partners/messenger-configuration') && + !store.state.isAuth && + activeNetwork.name.toLowerCase() !== 'columbus' + ) { return } return ( diff --git a/src/views/settings/Links.tsx b/src/views/settings/Links.tsx index 08acc925..482cc201 100644 --- a/src/views/settings/Links.tsx +++ b/src/views/settings/Links.tsx @@ -8,6 +8,7 @@ import store from 'wallet/store' import { useSmartContract } from '../../helpers/useSmartContract' import { useAppDispatch, useAppSelector } from '../../hooks/reduxHooks' import { changeActiveApp } from '../../redux/slices/app-config' +import { getActiveNetwork } from '../../redux/slices/network' function a11yProps(index: number) { return { @@ -45,7 +46,7 @@ export default function Links({ type = 'else' }: { type?: string }) { }, [path]) // eslint-disable-line react-hooks/exhaustive-deps const auth = useAppSelector(state => state.appConfig.isAuth) const sc = useSmartContract() - + const activeNetwork = useAppSelector(getActiveNetwork) const tabStyle = (index: number, currentValue: number) => ({ '&::after': { display: currentValue === index ? 'block' : 'none' }, color: currentValue === index ? theme.palette.text.primary : 'inherit', @@ -94,17 +95,19 @@ export default function Links({ type = 'else' }: { type?: string }) { key={0} sx={tabStyle(0, value)} />, - auth && store.state.activeWallet?.type !== 'multisig' && ( - navigate('/partners/messenger-configuration')} - className="tab" - disableRipple - label="My Partners Profile" - {...a11yProps(1)} - key={1} - sx={tabStyle(1, value)} - /> - ), + auth && + store.state.activeWallet?.type !== 'multisig' && + activeNetwork.name.toLowerCase() === 'columbus' && ( + navigate('/partners/messenger-configuration')} + className="tab" + disableRipple + label="My Partners Profile" + {...a11yProps(1)} + key={1} + sx={tabStyle(1, value)} + /> + ), ] const partnersSubTabs = [