import React, { Component } from 'react'; import PropTypes from 'prop-types'; import copyToClipboard from 'copy-to-clipboard'; import { shortenAddress } from '../../../helpers/utils/util'; import Tooltip from '../../ui/tooltip'; import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils'; import { SECOND } from '../../../../shared/constants/time'; class SelectedAccount extends Component { state = { copied: false, }; static contextTypes = { t: PropTypes.func, }; static propTypes = { selectedIdentity: PropTypes.object.isRequired, }; componentDidMount() { this.copyTimeout = null; } componentWillUnmount() { if (this.copyTimeout) { clearTimeout(this.copyTimeout); this.copyTimeout = null; } } render() { const { t } = this.context; const { selectedIdentity } = this.props; const checksummedAddress = toChecksumHexAddress(selectedIdentity.address); return (