import React from 'react'; import PropTypes from 'prop-types'; import CustodyLabels from '../../../components/institutional/custody-labels'; import { SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP } from '../../../../shared/constants/swaps'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import { shortenAddress } from '../../../helpers/utils/util'; import Tooltip from '../../../components/ui/tooltip'; import { TextVariant, JustifyContent, BlockSize, Display, IconColor, FlexDirection, AlignItems, } from '../../../helpers/constants/design-system'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { Box, Button, Label, Icon, IconName, IconSize, ButtonLink, BUTTON_VARIANT, BUTTON_SIZES, Text, } from '../../../components/component-library'; import { useCopyToClipboard } from '../../../hooks/useCopyToClipboard'; const getButtonLinkHref = (account) => { const url = SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP[CHAIN_IDS.MAINNET]; return `${url}address/${account.address}`; }; export default function CustodyAccountList({ rawList, accounts, onAccountChange, selectedAccounts, onCancel, onAddAccounts, custody, }) { const t = useI18nContext(); const [copied, handleCopy] = useCopyToClipboard(); const tooltipText = copied ? t('copiedExclamation') : t('copyToClipboard'); const disabled = !selectedAccounts || Object.keys(selectedAccounts).length === 0; return ( {accounts.map((account, idx) => ( {!rawList && ( onAccountChange({ name: account.name, address: account.address, custodianDetails: account.custodianDetails, labels: account.labels, chainId: account.chainId, }) } checked={selectedAccounts[account.address] || false} /> )} {account.labels && ( )} ))} {!rawList && ( )} ); } CustodyAccountList.propTypes = { custody: PropTypes.string, accounts: PropTypes.array.isRequired, onAccountChange: PropTypes.func, selectedAccounts: PropTypes.object, onAddAccounts: PropTypes.func, onCancel: PropTypes.func, rawList: PropTypes.bool, };