-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: account management menu (#6724)
* chore: add manage accounts menu item * chore: enable account management for dev * chore: make account management a connectedMenuComponent concern * chore: add ledger menu & refactor * chore: add demo wallet menu * chore: add kk connected menu * chore: add ledger comment * fix: hide MenuDivider when !isAccountManagementEnabled
- Loading branch information
1 parent
55c5b81
commit d7eab60
Showing
7 changed files
with
116 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EditIcon } from '@chakra-ui/icons' | ||
import { MenuDivider, MenuItem } from '@chakra-ui/react' | ||
import { useCallback } from 'react' | ||
import { useTranslate } from 'react-polyglot' | ||
import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag' | ||
import { useWallet } from 'hooks/useWallet/useWallet' | ||
|
||
import { WalletActions } from '../actions' | ||
|
||
const editIcon = <EditIcon /> | ||
|
||
export const DemoMenu = () => { | ||
const translate = useTranslate() | ||
const { dispatch: walletDispatch } = useWallet() | ||
const isAccountManagementEnabled = useFeatureFlag('AccountManagement') | ||
|
||
const handleManageAccountsMenuItemClick = useCallback(() => { | ||
walletDispatch({ type: WalletActions.SET_WALLET_MODAL, payload: true }) | ||
}, [walletDispatch]) | ||
|
||
return ( | ||
<> | ||
{isAccountManagementEnabled && ( | ||
<> | ||
<MenuDivider /> | ||
<MenuItem icon={editIcon} onClick={handleManageAccountsMenuItemClick}> | ||
{translate('manageAccounts.menuTitle')} | ||
</MenuItem> | ||
</> | ||
)} | ||
</> | ||
) | ||
} |
33 changes: 33 additions & 0 deletions
33
src/context/WalletProvider/KeepKey/components/KeepKeyMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EditIcon } from '@chakra-ui/icons' | ||
import { MenuDivider, MenuItem } from '@chakra-ui/react' | ||
import { useCallback } from 'react' | ||
import { useTranslate } from 'react-polyglot' | ||
import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag' | ||
import { useModal } from 'hooks/useModal/useModal' | ||
|
||
const editIcon = <EditIcon /> | ||
|
||
export const KeepKeyConnectedMenuItems = () => { | ||
const translate = useTranslate() | ||
const isAccountManagementEnabled = useFeatureFlag('AccountManagement') | ||
|
||
const accountManagementPopover = useModal('backupNativePassphrase') // FIXME: use accountManagementPopover once ready | ||
|
||
const handleManageAccountsMenuItemClick = useCallback( | ||
() => accountManagementPopover.open({}), | ||
[accountManagementPopover], | ||
) | ||
|
||
return ( | ||
<> | ||
{isAccountManagementEnabled && ( | ||
<> | ||
<MenuDivider /> | ||
<MenuItem icon={editIcon} onClick={handleManageAccountsMenuItemClick}> | ||
{translate('manageAccounts.menuTitle')} | ||
</MenuItem> | ||
</> | ||
)} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters