import React from 'react'; import { useDispatch } from 'react-redux'; import { openModal } from 'soapbox/actions/modals'; import { Text, Icon, Stack, HStack } from 'soapbox/components/ui'; import { CopyableInput } from 'soapbox/features/forms'; import { getExplorerUrl } from '../utils/block_explorer'; import { getTitle } from '../utils/coin_db'; import CryptoIcon from './crypto_icon'; export interface ICryptoAddress { address: string, ticker: string, note?: string, } const CryptoAddress: React.FC = (props): JSX.Element => { const { address, ticker, note } = props; const dispatch = useDispatch(); const handleModalClick = (e: React.MouseEvent): void => { dispatch(openModal('CRYPTO_DONATE', props)); e.preventDefault(); }; const title = getTitle(ticker); const explorerUrl = getExplorerUrl(ticker, address); return ( {title || ticker.toUpperCase()} {explorerUrl && ( )} {note && ( {note} )}
); }; export default CryptoAddress;