Skip to content

Commit

Permalink
fix: [lw-11768] hide switch to nami mode option when using shared wal…
Browse files Browse the repository at this point in the history
…let (#1495)
  • Loading branch information
vetalcore authored Oct 31, 2024
1 parent 6b9db26 commit 63a4114
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 (
Expand All @@ -28,7 +30,7 @@ export const Settings = ({ defaultPassphraseVisible, defaultMnemonic }: Settings
/>
<SettingsHelp popupView />
<SettingsLegal />
{useSwitchToNamiMode && <SettingsSwitchToNami popupView />}
{useSwitchToNamiMode && !isSharedWallet && <SettingsSwitchToNami popupView />}
<SettingsRemoveWallet popupView />
</div>
</ContentLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = (
Expand All @@ -43,7 +45,7 @@ export const SettingsLayout = ({
<SettingsSecurity defaultPassphraseVisible={defaultPassphraseVisible} defaultMnemonic={defaultMnemonic} />
<SettingsHelp />
<SettingsLegal />
{useSwitchToNamiMode && <SettingsSwitchToNami />}
{useSwitchToNamiMode && !isSharedWallet && <SettingsSwitchToNami />}
<SettingsRemoveWallet />
</SectionLayout>
</Layout>
Expand Down
5 changes: 5 additions & 0 deletions packages/nami/src/adapters/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 63a4114

Please sign in to comment.