From e052a449980f516e788694a8561ac4912bfe1e50 Mon Sep 17 00:00:00 2001 From: katspaugh Date: Thu, 26 Oct 2023 13:33:14 +0200 Subject: [PATCH] Feature toggle --- src/components/common/Header/index.tsx | 12 +++++++++--- src/utils/chains.ts | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/common/Header/index.tsx b/src/components/common/Header/index.tsx index 37a97279dd..c18ebcd039 100644 --- a/src/components/common/Header/index.tsx +++ b/src/components/common/Header/index.tsx @@ -17,6 +17,8 @@ import useSafeAddress from '@/hooks/useSafeAddress' import BatchIndicator from '@/components/batch/BatchIndicator' import WalletConnectUi from '@/components/walletconnect' import { PushNotificationsBanner } from '@/components/settings/PushNotifications/PushNotificationsBanner' +import { useCurrentChain } from '@/hooks/useChains' +import { hasFeature, FEATURES } from '@/utils/chains' type HeaderProps = { onMenuToggle?: Dispatch> @@ -28,6 +30,8 @@ const Header = ({ onMenuToggle, onBatchToggle }: HeaderProps): ReactElement => { const safeAddress = useSafeAddress() const showSafeToken = safeAddress && !!getSafeTokenAddress(chainId) const router = useRouter() + const chain = useCurrentChain() + const enableWc = !!chain && hasFeature(chain, FEATURES.NATIVE_WALLETCONNECT) // Logo link: if on Dashboard, link to Welcome, otherwise to the root (which redirects to either Dashboard or Welcome) const logoHref = router.pathname === AppRoutes.home ? AppRoutes.welcome : AppRoutes.index @@ -78,9 +82,11 @@ const Header = ({ onMenuToggle, onBatchToggle }: HeaderProps): ReactElement => { )} -
- -
+ {enableWc && ( +
+ +
+ )}
diff --git a/src/utils/chains.ts b/src/utils/chains.ts index 7ab92eed6c..f4bcf886fb 100644 --- a/src/utils/chains.ts +++ b/src/utils/chains.ts @@ -15,6 +15,7 @@ export enum FEATURES { EIP1271 = 'EIP1271', RISK_MITIGATION = 'RISK_MITIGATION', PUSH_NOTIFICATIONS = 'PUSH_NOTIFICATIONS', + NATIVE_WALLETCONNECT = 'NATIVE_WALLETCONNECT', } export const hasFeature = (chain: ChainInfo, feature: FEATURES): boolean => {