You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.9 KiB
72 lines
1.9 KiB
8 years ago
|
import React from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
8 years ago
|
import ReactModal from 'react-modal'
|
||
|
import styles from './PeerModal.scss'
|
||
|
|
||
8 years ago
|
const PeerModal = ({ isOpen, resetPeer, peer, disconnect }) => {
|
||
|
const customStyles = {
|
||
|
overlay: {
|
||
|
cursor: 'pointer',
|
||
|
overflowY: 'auto'
|
||
|
},
|
||
|
content: {
|
||
|
top: 'auto',
|
||
|
left: '20%',
|
||
|
right: '0',
|
||
|
bottom: 'auto',
|
||
|
width: '40%',
|
||
|
margin: '50px auto',
|
||
|
padding: '40px'
|
||
8 years ago
|
}
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
return (
|
||
|
<ReactModal
|
||
|
isOpen={isOpen}
|
||
|
contentLabel='No Overlay Click Modal'
|
||
|
ariaHideApp
|
||
|
shouldCloseOnOverlayClick
|
||
|
onRequestClose={() => resetPeer(null)}
|
||
|
parentSelector={() => document.body}
|
||
|
style={customStyles}
|
||
|
>
|
||
|
{
|
||
|
peer ?
|
||
|
<div className={styles.peer}>
|
||
|
<header className={styles.header}>
|
||
|
<h1 data-hint='Peer address' className='hint--top-left'>{peer.address}</h1>
|
||
|
<h2 data-hint='Peer public key' className='hint--top-left'>{peer.pub_key}</h2>
|
||
|
</header>
|
||
8 years ago
|
|
||
8 years ago
|
<div className={styles.details}>
|
||
|
<dl>
|
||
|
<dt>Satoshis Received</dt>
|
||
|
<dd>{peer.sat_recv}</dd>
|
||
|
<dt>Satoshis Sent</dt>
|
||
|
<dd>{peer.sat_sent}</dd>
|
||
|
<dt>Bytes Received</dt>
|
||
|
<dd>{peer.bytes_recv}</dd>
|
||
|
<dt>Bytes Sent</dt>
|
||
|
<dd>{peer.bytes_sent}</dd>
|
||
|
</dl>
|
||
8 years ago
|
</div>
|
||
7 years ago
|
<div className={styles.close} onClick={() => disconnect({ pubkey: peer.pub_key })}>
|
||
8 years ago
|
<div>Disconnect peer</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
:
|
||
|
null
|
||
|
}
|
||
|
</ReactModal>
|
||
|
)
|
||
8 years ago
|
}
|
||
|
|
||
8 years ago
|
PeerModal.propTypes = {
|
||
|
isOpen: PropTypes.bool.isRequired,
|
||
|
resetPeer: PropTypes.func.isRequired,
|
||
|
peer: PropTypes.object,
|
||
|
disconnect: PropTypes.func.isRequired
|
||
|
}
|
||
8 years ago
|
|
||
|
export default PeerModal
|