import React from 'react' import PropTypes from 'prop-types' import find from 'lodash/find' import ReactModal from 'react-modal' import FaCircle from 'react-icons/lib/fa/circle' import MdClose from 'react-icons/lib/md/close' import { btc } from 'utils' import styles from './ContactModal.scss' const ContactModal = ({ isOpen, channel, closeContactModal, channelNodes, closeChannel, closingChannelIds }) => { if (!channel) { return } const customStyles = { overlay: { cursor: 'pointer', overflowY: 'auto' }, content: { top: 'auto', left: '0', right: '0', bottom: 'auto', width: '40%', margin: '50px auto', borderRadius: 'none', padding: '0' } } const removeClicked = () => { closeChannel({ channel_point: channel.channel_point, chan_id: channel.chan_id, force: !channel.active }) } // the remote node for the channel const node = find(channelNodes, { pub_key: channel.remote_pubkey }) return ( document.body} style={customStyles} > {channel && (
{channel.active ? 'Online' : 'Offline'}
{node &&

{node.alias}

}

{channel.remote_pubkey}

Can Pay

{btc.satoshisToBtc(channel.local_balance)} BTC

Can Receive

{btc.satoshisToBtc(channel.remote_balance)} BTC

Total Bitcoin Sent

{btc.satoshisToBtc(channel.total_satoshis_sent)} BTC

Total Bitcoin Received

{btc.satoshisToBtc(channel.total_satoshis_received)} BTC

)}
) } ContactModal.propTypes = { channel: PropTypes.object, isOpen: PropTypes.bool.isRequired, closeContactModal: PropTypes.func.isRequired, channelNodes: PropTypes.array.isRequired, closeChannel: PropTypes.func.isRequired, closingChannelIds: PropTypes.array.isRequired } export default ContactModal