import React from 'react'; import { openModal } from 'soapbox/actions/modals'; import CopyableInput from 'soapbox/components/copyable-input'; import { Text, Icon, Stack, HStack } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; 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 = useAppDispatch(); 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;