diff --git a/apps/browser-extension-wallet/.env.defaults b/apps/browser-extension-wallet/.env.defaults index 5525b46cb8..b5ea025921 100644 --- a/apps/browser-extension-wallet/.env.defaults +++ b/apps/browser-extension-wallet/.env.defaults @@ -18,7 +18,8 @@ USE_DIFFERENT_MNEMONIC_LENGTHS=true USE_NFT_FOLDERS=true USE_MULTI_CURRENCY=true USE_HIDE_MY_BALANCE=true -USE_MULTI_DELEGATION_STAKING=true +USE_MULTI_DELEGATION_STAKING_LEDGER=false +USE_MULTI_DELEGATION_STAKING_TREZOR=false USE_ADA_HANDLE=true USE_DATA_CHECK=false USE_POSTHOG_ANALYTICS=true diff --git a/apps/browser-extension-wallet/.env.example b/apps/browser-extension-wallet/.env.example index 76bb6bead5..50c5ebf43c 100644 --- a/apps/browser-extension-wallet/.env.example +++ b/apps/browser-extension-wallet/.env.example @@ -18,7 +18,8 @@ USE_DIFFERENT_MNEMONIC_LENGTHS=true USE_NFT_FOLDERS=true USE_MULTI_CURRENCY=true USE_HIDE_MY_BALANCE=true -USE_MULTI_DELEGATION_STAKING=true +USE_MULTI_DELEGATION_STAKING_LEDGER=false +USE_MULTI_DELEGATION_STAKING_TREZOR=false USE_ADA_HANDLE=true USE_HANDLE_AB=false USE_DATA_CHECK=false diff --git a/apps/browser-extension-wallet/src/hooks/useMultiDelegationEnabled.ts b/apps/browser-extension-wallet/src/hooks/useMultiDelegationEnabled.ts index e30e558e39..f1731066f3 100644 --- a/apps/browser-extension-wallet/src/hooks/useMultiDelegationEnabled.ts +++ b/apps/browser-extension-wallet/src/hooks/useMultiDelegationEnabled.ts @@ -4,10 +4,16 @@ import { useMemo } from 'react'; export const useMultiDelegationEnabled = (): boolean => { const { getKeyAgentType } = useWalletStore(); - const inMemoryWallet = useMemo( - () => getKeyAgentType() === Wallet.KeyManagement.KeyAgentType.InMemory, - [getKeyAgentType] - ); - return process.env.USE_MULTI_DELEGATION_STAKING === 'true' && inMemoryWallet; + return useMemo(() => { + const keyAgentType = getKeyAgentType(); + switch (keyAgentType) { + case Wallet.KeyManagement.KeyAgentType.Ledger: + return process.env.USE_MULTI_DELEGATION_STAKING_LEDGER === 'true'; + case Wallet.KeyManagement.KeyAgentType.Trezor: + return process.env.USE_MULTI_DELEGATION_STAKING_TREZOR === 'true'; + default: + return true; + } + }, [getKeyAgentType]); }; diff --git a/packages/staking/src/features/Drawer/StakePoolDetailsDrawer.tsx b/packages/staking/src/features/Drawer/StakePoolDetailsDrawer.tsx index 6675b0c912..3e0c481dcf 100644 --- a/packages/staking/src/features/Drawer/StakePoolDetailsDrawer.tsx +++ b/packages/staking/src/features/Drawer/StakePoolDetailsDrawer.tsx @@ -72,17 +72,20 @@ export const StakePoolDetailsDrawer = ({ }); }, [password, portfolioMutators, backgroundServiceAPIContextSetWalletPassword, removePassword]); + const shouldShowBackIcon = + activeDrawerStep && typeof showBackIcon === 'function' ? showBackIcon(activeDrawerStep) : showBackIcon; + useKeyboardShortcut(['Escape'], () => { - if (activeDrawerStep && typeof showBackIcon === 'function' ? showBackIcon(activeDrawerStep) : showBackIcon) { + if (shouldShowBackIcon) { onGoBack(); } else { closeDrawer(); } }); - const createArrowIconCallback = () => { - if (activeDrawerStep && typeof showBackIcon === 'function' ? showBackIcon(activeDrawerStep) : showBackIcon) { - return popupView ? closeDrawer : onGoBack; + const arrowIconCallback = () => { + if (shouldShowBackIcon) { + return popupView ? closeDrawer() : onGoBack(); } // eslint-disable-next-line consistent-return, unicorn/no-useless-undefined return undefined; @@ -97,10 +100,14 @@ export const StakePoolDetailsDrawer = ({ { - onBackButtonClick?.(); - createArrowIconCallback(); - }} + onArrowIconClick={ + !shouldShowBackIcon + ? undefined + : () => { + onBackButtonClick?.(); + arrowIconCallback(); + } + } onCloseIconClick={() => { if ( activeDrawerStep && typeof showCloseIcon === 'function' ? showCloseIcon(activeDrawerStep) : showCloseIcon diff --git a/packages/staking/src/features/Drawer/TransactionFail.tsx b/packages/staking/src/features/Drawer/TransactionFail.tsx index 149b5d8479..369f861b5c 100644 --- a/packages/staking/src/features/Drawer/TransactionFail.tsx +++ b/packages/staking/src/features/Drawer/TransactionFail.tsx @@ -99,8 +99,8 @@ export const TransactionFailFooter = ({ popupView }: TransactionFailProps): Reac ) : (