Skip to content

Commit

Permalink
Merge branch 'main' into feat/CP-9461_connect_core
Browse files Browse the repository at this point in the history
  • Loading branch information
vvava committed Jan 16, 2025
2 parents da51f55 + 3bd105e commit 2e67c0e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 46 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@avalabs/core-coingecko-sdk": "3.1.0-alpha.27",
"@avalabs/core-covalent-sdk": "3.1.0-alpha.27",
"@avalabs/core-etherscan-sdk": "3.1.0-alpha.27",
"@avalabs/core-k2-components": "4.18.0-alpha.50",
"@avalabs/core-k2-components": "4.18.0-alpha.53",
"@avalabs/core-snowtrace-sdk": "3.1.0-alpha.27",
"@avalabs/core-token-prices-sdk": "3.1.0-alpha.27",
"@avalabs/core-utils-sdk": "3.1.0-alpha.27",
Expand Down
8 changes: 3 additions & 5 deletions src/localization/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
"Active Wallet:": "Active Wallet:",
"Activity": "Activity",
"Add <bold>one</bold> recovery method to continue.": "Add <bold>one</bold> recovery method to continue.",
"Add Account": "Add Account",
"Add Address via": "Add Address via",
"Add Custom Token": "Add Custom Token",
"Add Delegator": "Add Delegator",
"Add Network": "Add Network",
"Add New Address": "Add New Address",
"Add New Asset?": "Add New Asset?",
"Add New Network?": "Add New Network?",
"Add Next": "Add Next",
Expand All @@ -47,7 +48,6 @@
"Add Subnet Validator": "Add Subnet Validator",
"Add Token": "Add Token",
"Add Validator": "Add Validator",
"Add Wallet": "Add Wallet",
"Add Wallet with Keystore File": "Add Wallet with Keystore File",
"Add Wallet with Ledger": "Add Wallet with Ledger",
"Add Wallet with Recovery Phrase": "Add Wallet with Recovery Phrase",
Expand Down Expand Up @@ -411,13 +411,10 @@
"If you do not have the latest Avalanche App, please add it through the <ledgerLink>Ledger Live</ledgerLink> app manager.": "If you do not have the latest Avalanche App, please add it through the <ledgerLink>Ledger Live</ledgerLink> app manager.",
"If you ever change browsers or move computers, you will need this Secret Recovery Phrase to access your accounts. Save them somewhere safe and secret.": "If you ever change browsers or move computers, you will need this Secret Recovery Phrase to access your accounts. Save them somewhere safe and secret.",
"Import": "Import",
"Import Account": "Import Account",
"Import Details": "Import Details",
"Import Duplicate Account?": "Import Duplicate Account?",
"Import Keystore File": "Import Keystore File",
"Import Private Key": "Import Private Key",
"Import with Fireblocks": "Import with Fireblocks",
"Import with Wallet Connect": "Import with Wallet Connect",
"Imported": "Imported",
"Imported Private Key": "Imported Private Key",
"In order for this network to be fully functional, you need to provide your Glacier API key. You will be prompted to do so upon approval.": "In order for this network to be fully functional, you need to provide your Glacier API key. You will be prompted to do so upon approval.",
Expand Down Expand Up @@ -463,6 +460,7 @@
"Keystone": "Keystone",
"Keystone Support": "Keystone Support",
"Keystone {{number}}": "Keystone {{number}}",
"Keystore File": "Keystore File",
"Korean": "Korean",
"Language": "Language",
"Learn More": "Learn More",
Expand Down
61 changes: 25 additions & 36 deletions src/pages/Accounts/components/AccountsActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
ListIcon,
Typography,
TypographyProps,
PlusIcon,
LedgerIcon,
KeystoreIcon,
} from '@avalabs/core-k2-components';
import { useCallback, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
Expand Down Expand Up @@ -66,21 +67,15 @@ const RoundedButtonGroup = styled(ButtonGroup)`
}
`;

const MenuSubheader = (props: TypographyProps) => (
const MenuHeader = (props: TypographyProps) => (
<Typography
variant="caption"
component="li"
sx={{ px: 2, pt: 1, pb: 0.5, cursor: 'default' }}
color="text.secondary"
variant="button"
sx={{ px: 2, py: 1, cursor: 'default', fontSize: 18 }}
color="grey.50"
{...props}
/>
);

const WALLET_IMPORT_FLAGS = [
FeatureGates.ADD_WALLET_WITH_SEEDPHRASE,
FeatureGates.ADD_WALLET_WITH_KEYSTORE_FILE,
];

export const AccountsActionButton = ({
isLoading,
onAddNewAccount,
Expand Down Expand Up @@ -142,10 +137,6 @@ export const AccountsActionButton = ({
return '';
}, [t, network]);

const isAnyWalletImportAvailable = WALLET_IMPORT_FLAGS.some(
(flag) => featureFlags[flag],
);

return (
<RoundedButtonGroup
disabled={isLoading}
Expand All @@ -165,9 +156,8 @@ export const AccountsActionButton = ({
data-testid={'add-primary-account'}
isLoading={isLoading}
disabled={isLoading || !canCreateAccount}
startIcon={<PlusIcon size={24} />}
>
{t('Add Account')}
{t('Add New Address')}
</Button>
</Tooltip>

Expand Down Expand Up @@ -202,24 +192,26 @@ export const AccountsActionButton = ({
py: 0.5,
mb: 1,
overflow: 'hidden',
backgroundColor: 'grey.800',
backgroundColor: 'grey.850',
width: 272,
boxShadow: '0px 4px 24px 0px rgba(0, 0, 0, 0.60)',
}}
>
<MenuSubheader>{t('Import Account')}</MenuSubheader>
<MenuHeader>{t('Add Address via')}</MenuHeader>
<StyledMenuItem
onClick={goToImportScreen}
data-testid="add-import-account"
>
<KeyIcon size={16} sx={{ pr: 1 }} />
{t('Import Private Key')}
{t('Private Key')}
</StyledMenuItem>
{featureFlags[FeatureGates.IMPORT_WALLET_CONNECT] && (
<StyledMenuItem
data-testid="import-wallet-connect"
onClick={goToWalletConnectScreen}
>
<WalletConnectIcon size={16} sx={{ pr: 1 }} />
{t('Import with Wallet Connect')}
{t('Wallet Connect')}
</StyledMenuItem>
)}
{featureFlags[FeatureGates.IMPORT_FIREBLOCKS] && (
Expand All @@ -237,39 +229,36 @@ export const AccountsActionButton = ({
disabled={Boolean(fireblocksDisabledReason)}
>
<FireblocksIcon size={16} sx={{ pr: 1 }} />
{t('Import with Fireblocks')}
{t('Fireblocks')}
</StyledMenuItem>
</Tooltip>
)}

{isAnyWalletImportAvailable && (
<MenuSubheader>{t('Add Wallet')}</MenuSubheader>
)}
{featureFlags[FeatureGates.ADD_WALLET_WITH_SEEDPHRASE] && (
<StyledMenuItem
onClick={goToAddSeedphraseScreen}
data-testid="add-wallet-seed-phrase"
>
<ListIcon size={16} sx={{ pr: 1 }} />
{t('Add Wallet with Recovery Phrase')}
{t('Recovery Phrase')}
</StyledMenuItem>
)}
{featureFlags[FeatureGates.ADD_WALLET_WITH_KEYSTORE_FILE] && (
{featureFlags[FeatureGates.ADD_WALLET_WITH_LEDGER] && (
<StyledMenuItem
onClick={goToAddKeystoreFileScreen}
data-testid="add-wallet-keystore-file"
onClick={goToAddLedgerScreen}
data-testid="add-wallet-ledger"
>
<ListIcon size={16} sx={{ pr: 1 }} />
{t('Add Wallet with Keystore File')}
<LedgerIcon size={16} sx={{ pr: 1 }} />
{t('Ledger')}
</StyledMenuItem>
)}
{featureFlags[FeatureGates.ADD_WALLET_WITH_LEDGER] && (
{featureFlags[FeatureGates.ADD_WALLET_WITH_KEYSTORE_FILE] && (
<StyledMenuItem
onClick={goToAddLedgerScreen}
data-testid="add-wallet-ledger"
onClick={goToAddKeystoreFileScreen}
data-testid="add-wallet-keystore-file"
>
<ListIcon size={16} sx={{ pr: 1 }} />
{t('Add Wallet with Ledger')}
<KeystoreIcon size={16} sx={{ pr: 1 }} />
{t('Keystore File')}
</StyledMenuItem>
)}
</MenuList>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@
dependencies:
"@avalabs/core-utils-sdk" "3.1.0-alpha.27"

"@avalabs/[email protected].50":
version "4.18.0-alpha.50"
resolved "https://registry.yarnpkg.com/@avalabs/core-k2-components/-/core-k2-components-4.18.0-alpha.50.tgz#129b2615fa170a0373b82557c1d829fbb4c31867"
integrity sha512-iG5xsZBC9LuLzWihV/JjbtWwA9zVQyKxmabpKhvNp8Ywaq6h2o7kmMUNT8DfGnaUgDePfINJ57DZsH3oBnNcCg==
"@avalabs/[email protected].53":
version "4.18.0-alpha.53"
resolved "https://registry.yarnpkg.com/@avalabs/core-k2-components/-/core-k2-components-4.18.0-alpha.53.tgz#a7a06a613b7a33706adb0817a06462f73d4324a7"
integrity sha512-Y+30BXVunKT1BgUglPzQd050PO+DwfyySuv0ySJU2DKIqQwE+EV9KAPjI4jXnf0DQN9d12aPyNlbVW7YkoIJ6w==
dependencies:
"@emotion/react" "11.11.1"
"@emotion/styled" "11.11.0"
Expand Down

0 comments on commit 2e67c0e

Please sign in to comment.