Skip to content

Commit

Permalink
Feature toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Oct 26, 2023
1 parent d1a0eb3 commit e052a44
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/common/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<SetStateAction<boolean>>
Expand All @@ -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
Expand Down Expand Up @@ -78,9 +82,11 @@ const Header = ({ onMenuToggle, onBatchToggle }: HeaderProps): ReactElement => {
</div>
)}

<div className={classnames(css.element, css.hideMobile)}>
<WalletConnectUi />
</div>
{enableWc && (
<div className={classnames(css.element, css.hideMobile)}>
<WalletConnectUi />
</div>
)}

<div className={classnames(css.element, css.connectWallet)}>
<ConnectWallet />
Expand Down
1 change: 1 addition & 0 deletions src/utils/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit e052a44

Please sign in to comment.