From 63a4114b989338f4c0c4e15b5c11d1aae78fd006 Mon Sep 17 00:00:00 2001 From: vetalcore Date: Thu, 31 Oct 2024 18:15:53 +0200 Subject: [PATCH] fix: [lw-11768] hide switch to nami mode option when using shared wallet (#1495) --- .../src/features/settings/components/Settings.tsx | 4 +++- .../features/settings/components/SettingsLayout.tsx | 4 +++- packages/nami/src/adapters/account.ts | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/browser-extension-wallet/src/features/settings/components/Settings.tsx b/apps/browser-extension-wallet/src/features/settings/components/Settings.tsx index 55208f318..1c6d295ea 100644 --- a/apps/browser-extension-wallet/src/features/settings/components/Settings.tsx +++ b/apps/browser-extension-wallet/src/features/settings/components/Settings.tsx @@ -5,6 +5,7 @@ import { SettingsWallet, SettingsSecurity, SettingsHelp, SettingsLegal, Settings import { SettingsRemoveWallet } from '@src/views/browser-view/features/settings/components/SettingsRemoveWallet'; import { SettingsSwitchToNami } from '@src/views/browser-view/features/settings/components/SettingsSwitchToNami'; import { usePostHogClientContext } from '@providers/PostHogClientProvider'; +import { useWalletStore } from '@src/stores'; export interface SettingsProps { defaultPassphraseVisible?: boolean; @@ -14,6 +15,7 @@ export interface SettingsProps { export const Settings = ({ defaultPassphraseVisible, defaultMnemonic }: SettingsProps): React.ReactElement => { const { t } = useTranslation(); const posthog = usePostHogClientContext(); + const { isSharedWallet } = useWalletStore(); const useSwitchToNamiMode = posthog?.isFeatureFlagEnabled('use-switch-to-nami-mode'); return ( @@ -28,7 +30,7 @@ export const Settings = ({ defaultPassphraseVisible, defaultMnemonic }: Settings /> - {useSwitchToNamiMode && } + {useSwitchToNamiMode && !isSharedWallet && } diff --git a/apps/browser-extension-wallet/src/views/browser-view/features/settings/components/SettingsLayout.tsx b/apps/browser-extension-wallet/src/views/browser-view/features/settings/components/SettingsLayout.tsx index ca1eae801..a3053e56f 100644 --- a/apps/browser-extension-wallet/src/views/browser-view/features/settings/components/SettingsLayout.tsx +++ b/apps/browser-extension-wallet/src/views/browser-view/features/settings/components/SettingsLayout.tsx @@ -9,6 +9,7 @@ import { Box } from '@input-output-hk/lace-ui-toolkit'; import MidnightPreLaunchBannerImage from '../../../../../../../../packages/core/src/ui/assets/images/midnight-launch-event-sidebar-banner.png'; import { SettingsSwitchToNami } from './SettingsSwitchToNami'; import { usePostHogClientContext } from '@providers/PostHogClientProvider'; +import { useWalletStore } from '@src/stores'; export interface SettingsLayoutProps { defaultPassphraseVisible?: boolean; @@ -21,6 +22,7 @@ export const SettingsLayout = ({ }: SettingsLayoutProps): React.ReactElement => { const { t } = useTranslation(); const posthog = usePostHogClientContext(); + const { isSharedWallet } = useWalletStore(); const useSwitchToNamiMode = posthog?.isFeatureFlagEnabled('use-switch-to-nami-mode'); const sidePanelContent = ( @@ -43,7 +45,7 @@ export const SettingsLayout = ({ - {useSwitchToNamiMode && } + {useSwitchToNamiMode && !isSharedWallet && } diff --git a/packages/nami/src/adapters/account.ts b/packages/nami/src/adapters/account.ts index 98f344128..66b9b37f6 100644 --- a/packages/nami/src/adapters/account.ts +++ b/packages/nami/src/adapters/account.ts @@ -180,6 +180,11 @@ export const useAccount = ({ const accountsMapper = getAcountsMapper(wallet); return 'accounts' in wallet ? wallet.accounts + .filter( + account => + account.purpose !== + Wallet.KeyManagement.KeyPurpose.MULTI_SIG, + ) // eslint-disable-next-line functional/prefer-tacit .map(account => accountsMapper(account)) .sort((a, b) => a.index - b.index)