diff --git a/src/extension/components/ARC0300AccountImportModalContent/ARC0300AccountImportModalContent.tsx b/src/extension/components/ARC0300AccountImportModalContent/ARC0300AccountImportModalContent.tsx index df672bbc..3e46c78e 100644 --- a/src/extension/components/ARC0300AccountImportModalContent/ARC0300AccountImportModalContent.tsx +++ b/src/extension/components/ARC0300AccountImportModalContent/ARC0300AccountImportModalContent.tsx @@ -12,12 +12,14 @@ import { } from '@chakra-ui/react'; import React, { FC, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { IoDownloadOutline } from 'react-icons/io5'; import { useDispatch } from 'react-redux'; import { useNavigate } from 'react-router-dom'; // components import AccountItem from '@extension/components/AccountItem'; import Button from '@extension/components/Button'; +import EmptyState from '@extension/components/EmptyState'; // constants import { @@ -73,7 +75,6 @@ import type { import convertPublicKeyToAVMAddress from '@extension/utils/convertPublicKeyToAVMAddress'; import ellipseAddress from '@extension/utils/ellipseAddress'; import flattenAccountImportSchemaToNewAccounts from '@extension/utils/flattenAccountImportSchemaToNewAccounts'; -import EmptyState from '@extension/components/EmptyState'; const ARC0300AccountImportModalContent: FC< IARC0300ModalContentProps @@ -310,6 +311,7 @@ const ARC0300AccountImportModalContent: FC< diff --git a/src/extension/components/AmountInput/types/IOnEventOptions.ts b/src/extension/components/AmountInput/types/IOnEventOptions.ts new file mode 100644 index 00000000..8622b452 --- /dev/null +++ b/src/extension/components/AmountInput/types/IOnEventOptions.ts @@ -0,0 +1,9 @@ +// types +import type { IAssetTypes, INativeCurrency } from '@extension/types'; + +interface IOnEventOptions { + asset: IAssetTypes | INativeCurrency | null; + maximumAmountInAtomicUnits: string; +} + +export default IOnEventOptions; diff --git a/src/extension/components/AmountInput/types/IProps.ts b/src/extension/components/AmountInput/types/IProps.ts index 05d4eff4..baf955fa 100644 --- a/src/extension/components/AmountInput/types/IProps.ts +++ b/src/extension/components/AmountInput/types/IProps.ts @@ -1,3 +1,5 @@ +import type { NumberInputProps } from '@chakra-ui/react'; + // types import type { IAccountWithExtendedProps, @@ -5,17 +7,17 @@ import type { INativeCurrency, INetworkWithTransactionParams, } from '@extension/types'; +import type IOnEventOptions from './IOnEventOptions'; -interface IProps { +interface IProps extends NumberInputProps { account: IAccountWithExtendedProps; asset: IAssetTypes | INativeCurrency; - disabled?: boolean; id?: string; + label?: string; + maximumAmountInAtomicUnits: string; network: INetworkWithTransactionParams; - maximumTransactionAmount: string; - onChange: (value: string) => void; + onMaximumAmountClick: (options: IOnEventOptions) => void; required?: boolean; - value: string | null; } export default IProps; diff --git a/src/extension/components/AmountInput/types/index.ts b/src/extension/components/AmountInput/types/index.ts index f404deed..efd9c847 100644 --- a/src/extension/components/AmountInput/types/index.ts +++ b/src/extension/components/AmountInput/types/index.ts @@ -1 +1,2 @@ +export type { default as IOnEventOptions } from './IOnEventOptions'; export type { default as IProps } from './IProps'; diff --git a/src/extension/components/AssetSelect/AssetSelect.tsx b/src/extension/components/AssetSelect/AssetSelect.tsx index 102a0c94..1ca02b94 100644 --- a/src/extension/components/AssetSelect/AssetSelect.tsx +++ b/src/extension/components/AssetSelect/AssetSelect.tsx @@ -1,30 +1,43 @@ import { - HStack, + Button as ChakraButton, + Icon, Stack, - Tooltip, useDisclosure, VStack, } from '@chakra-ui/react'; -import React, { FC } from 'react'; +import React, { type FC } from 'react'; import { useTranslation } from 'react-i18next'; -import { GoSingleSelect } from 'react-icons/go'; +import { IoChevronDownOutline } from 'react-icons/io5'; // components import AssetItem from '@extension/components/AssetItem'; -import IconButton from '@extension/components/IconButton'; import Label from '@extension/components/Label'; // constants import { DEFAULT_GAP, INPUT_HEIGHT } from '@extension/constants'; +// hooks +import useBorderColor from '@extension/hooks/useBorderColor'; +import useButtonHoverBackgroundColor from '@extension/hooks/useButtonHoverBackgroundColor'; +import useColorModeValue from '@extension/hooks/useColorModeValue'; +import usePrimaryColor from '@extension/hooks/usePrimaryColor'; +import useSubTextColor from '@extension/hooks/useSubTextColor'; + // modals -import AssetSelectModal from '@extension/modals/AssetSelectModal'; +import AssetSelectModal from './AssetSelectModal'; + +// theme +import { theme } from '@extension/theme'; // types import type { IAssetTypes, INativeCurrency } from '@extension/types'; import type { IProps } from './types'; +// utils +import calculateIconSize from '@extension/utils/calculateIconSize'; + const AssetSelect: FC = ({ + _context, assets, disabled = false, label, @@ -34,57 +47,76 @@ const AssetSelect: FC = ({ value, }) => { const { t } = useTranslation(); + // hooks + const borderColor = useBorderColor(); + const buttonHoverBackgroundColor = useButtonHoverBackgroundColor(); + const primaryColorCode = useColorModeValue( + theme.colors.primaryLight['500'], + theme.colors.primaryDark['500'] + ); + const primaryColor = usePrimaryColor(); + const subTextColor = useSubTextColor(); const { isOpen: isAssetSelectModalOpen, onClose: onAssetSelectClose, onOpen: onAssetSelectModalOpen, } = useDisclosure(); // handlers - const handleAssetClick = () => onAssetSelectModalOpen(); - const handleOnAssetSelect = (_value: (IAssetTypes | INativeCurrency)[]) => + const handleOnClick = () => onAssetSelectModalOpen(); + const handleOnSelect = (_value: (IAssetTypes | INativeCurrency)[]) => onSelect(_value[0]); return ( <> {/*asset select modal*/} {/*label*/} - {label && ); diff --git a/src/extension/modals/AssetSelectModal/AssetSelectModal.tsx b/src/extension/components/AssetSelect/AssetSelectModal.tsx similarity index 92% rename from src/extension/modals/AssetSelectModal/AssetSelectModal.tsx rename to src/extension/components/AssetSelect/AssetSelectModal.tsx index f0d0ea08..a9695a2f 100644 --- a/src/extension/modals/AssetSelectModal/AssetSelectModal.tsx +++ b/src/extension/components/AssetSelect/AssetSelectModal.tsx @@ -15,9 +15,13 @@ import { Tooltip, VStack, } from '@chakra-ui/react'; -import React, { FC, useState } from 'react'; +import React, { type FC, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { IoChevronForward } from 'react-icons/io5'; +import { + IoCheckmarkDoneCircleOutline, + IoCheckmarkOutline, + IoChevronForward, +} from 'react-icons/io5'; // components import AssetItem from '@extension/components/AssetItem'; @@ -47,12 +51,13 @@ import { theme } from '@extension/theme'; // types import type { IAssetTypes, INativeCurrency } from '@extension/types'; -import type { IProps } from './types'; +import type { TAssetSelectModalProps } from './types'; // utils import calculateIconSize from '@extension/utils/calculateIconSize'; -const AssetSelectModal: FC = ({ +const AssetSelectModal: FC = ({ + _context, assets, isOpen, multiple, @@ -148,11 +153,11 @@ const AssetSelectModal: FC = ({ _hover={{ bg: buttonHoverBackgroundColor, }} - borderRadius={0} + borderRadius="full" fontSize="md" h={TAB_ITEM_HEIGHT} justifyContent="start" - key={`asset-select-modal-item-${index}`} + key={`${_context}-asset-select-modal-item-${index}`} onClick={handleOnChange(asset)} px={DEFAULT_GAP / 2} py={0} @@ -259,8 +264,12 @@ const AssetSelectModal: FC = ({ - {/*content*/} - {renderContent()} + {/*body*/} + + + {renderContent()} + + {/*footer*/} @@ -277,6 +286,7 @@ const AssetSelectModal: FC = ({ {multiple && (