// Copyright 2019-2026 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 import { faUsb } from '@fortawesome/free-brands-svg-icons'; import { faCodeBranch, faFileExport, faFileUpload, faKey, faPlusCircle, faQrcode } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { useCallback, useContext } from 'react'; import { AccountContext, Link, MediaContext, Menu, MenuDivider, MenuItem } from '../components/index.js'; import { useIsPopup, useLedger, useTranslation } from '../hooks/index.js'; import { windowOpen } from '../messaging.js'; import { styled } from '../styled.js'; interface Props { className?: string; reference: React.RefObject; } const jsonPath = '/account/restore-json'; const ledgerPath = '/account/import-ledger'; function MenuAdd ({ className, reference }: Props): React.ReactElement { const { t } = useTranslation(); const { master } = useContext(AccountContext); const mediaAllowed = useContext(MediaContext); const { isLedgerCapable, isLedgerEnabled } = useLedger(); const isPopup = useIsPopup(); const _openJson = useCallback( (): void => { windowOpen(jsonPath).catch(console.error); }, [] ); const _onOpenLedgerConnect = useCallback( (): void => { windowOpen(ledgerPath).catch(console.error); }, [] ); return ( { t('Create new account')} {!!master && ( <> {t('Derive from an account')} )} {t('Export all accounts')} {t('Import account from pre-existing seed')} {t('Restore account from backup JSON file')} {t('Attach external QR-signer account')} {isLedgerEnabled ? ( { t('Attach ledger account')} ) : ( { t('Connect Ledger device')} ) } ); } export default React.memo(styled(MenuAdd)` margin-top: 50px; right: 50px; // 24 + 18 + 8 user-select: none; .menuItem { span:first-child { height: 20px; margin-right: 8px; opacity: 0.5; width: 20px; } span { vertical-align: middle; } .svg-inline--fa { color: var(--iconNeutralColor); margin-right: 0.3rem; width: 0.875em; } } `);