1
- import React , { ReactNode , useCallback , useState , VFC } from 'react' ;
1
+ import React , { ReactNode , useCallback , useState , VFC , useMemo } from 'react' ;
2
2
import { Menu , MenuProps } from 'antd' ;
3
3
import {
4
4
AddNewWalletLink ,
@@ -20,7 +20,8 @@ import { WalletAccounts } from './components/WalletAccounts';
20
20
import { AddSharedWalletLink } from '@components/MainMenu/DropdownMenuOverlay/components/AddSharedWalletLink' ;
21
21
import { useWalletStore } from '@stores' ;
22
22
import classNames from 'classnames' ;
23
- import { AnyBip32Wallet } from '@cardano-sdk/web-extension' ;
23
+ import type { AnyBip32Wallet } from '@cardano-sdk/web-extension' ;
24
+ import { WalletType } from '@cardano-sdk/web-extension' ;
24
25
import { Wallet } from '@lace/cardano' ;
25
26
26
27
interface Props extends MenuProps {
@@ -39,7 +40,7 @@ export const DropdownMenuOverlay: VFC<Props> = ({
39
40
...props
40
41
} ) : React . ReactElement => {
41
42
const [ currentSection , setCurrentSection ] = useState < Sections > ( Sections . Main ) ;
42
- const { environmentName, setManageAccountsWallet } = useWalletStore ( ) ;
43
+ const { environmentName, setManageAccountsWallet, walletType } = useWalletStore ( ) ;
43
44
44
45
const openWalletAccounts = ( wallet : AnyBip32Wallet < Wallet . WalletMetadata , Wallet . AccountMetadata > ) => {
45
46
setManageAccountsWallet ( wallet ) ;
@@ -62,6 +63,14 @@ export const DropdownMenuOverlay: VFC<Props> = ({
62
63
</ >
63
64
) ;
64
65
66
+ const shouldShowSignMessage = useMemo (
67
+ ( ) =>
68
+ process . env . USE_MESSAGE_SIGNING === 'true' &&
69
+ ! isPopup &&
70
+ [ WalletType . InMemory , WalletType . Ledger ] . includes ( walletType ) ,
71
+ [ isPopup , walletType ]
72
+ ) ;
73
+
65
74
return (
66
75
< Menu { ...props } className = { styles . menuOverlay } data-testid = "header-menu" >
67
76
{ currentSection === Sections . Main && (
@@ -80,7 +89,7 @@ export const DropdownMenuOverlay: VFC<Props> = ({
80
89
< AddressBookLink />
81
90
< SettingsLink />
82
91
< Separator />
83
- { process . env . USE_MESSAGE_SIGNING === 'true' && ! isPopup && getSignMessageLink ( ) }
92
+ { shouldShowSignMessage && getSignMessageLink ( ) }
84
93
< ThemeSwitcher isPopup = { isPopup } />
85
94
< NetworkChoise onClick = { handleNetworkChoise } />
86
95
{ lockWalletButton && (
0 commit comments