import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import Identicon from '../../../../components/ui/identicon' import Button from '../../../../components/ui/button/button.component' import copyToClipboard from 'copy-to-clipboard' function quadSplit (address) { return '0x ' + address.slice(2).match(/.{1,4}/g).join(' ') } export default class ViewContact extends PureComponent { static contextTypes = { t: PropTypes.func, } static propTypes = { removeFromAddressBook: PropTypes.func, name: PropTypes.string, address: PropTypes.string, history: PropTypes.object, checkSummedAddress: PropTypes.string, memo: PropTypes.string, editRoute: PropTypes.string, } render () { const { t } = this.context const { history, name, address, checkSummedAddress, memo, editRoute } = this.props return (
{ name }
{ t('ethereumPublicAddress') }
{ quadSplit(checkSummedAddress) }
copyToClipboard(checkSummedAddress)} src="/images/copy-to-clipboard.svg" />
{ t('memo') }
{ memo }
) } }