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.
57 lines
1.4 KiB
57 lines
1.4 KiB
8 years ago
|
import React from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
8 years ago
|
import { TiPlus } from 'react-icons/lib/ti'
|
||
7 years ago
|
import PeerModal from './PeerModal'
|
||
|
import PeerForm from './PeerForm'
|
||
|
import Peer from './Peer'
|
||
8 years ago
|
import styles from './Peers.scss'
|
||
|
|
||
8 years ago
|
const Peers = ({
|
||
|
peersLoading,
|
||
|
peers,
|
||
|
setPeer,
|
||
|
modalPeer,
|
||
|
peerModalOpen,
|
||
|
peerForm,
|
||
|
setPeerForm,
|
||
|
connect,
|
||
|
disconnect
|
||
|
}) => (
|
||
|
<div className={styles.peers}>
|
||
|
<PeerModal isOpen={peerModalOpen} resetPeer={setPeer} peer={modalPeer} disconnect={disconnect} />
|
||
|
<PeerForm form={peerForm} setForm={setPeerForm} connect={connect} />
|
||
|
<div className={styles.header}>
|
||
|
<h3>Peers</h3>
|
||
|
<div
|
||
|
className={`${styles.connectPeer} hint--top`}
|
||
|
data-hint='Connect to a peer'
|
||
|
onClick={() => setPeerForm({ isOpen: true })}
|
||
|
>
|
||
8 years ago
|
<TiPlus />
|
||
8 years ago
|
</div>
|
||
|
</div>
|
||
|
<ul>
|
||
|
{
|
||
8 years ago
|
!peersLoading ?
|
||
8 years ago
|
peers.map(peer => <Peer key={peer.peer_id} peer={peer} setPeer={setPeer} />)
|
||
8 years ago
|
:
|
||
8 years ago
|
'Loading...'
|
||
|
}
|
||
|
</ul>
|
||
|
</div>
|
||
|
)
|
||
8 years ago
|
|
||
8 years ago
|
Peers.propTypes = {
|
||
|
peersLoading: PropTypes.bool.isRequired,
|
||
|
peers: PropTypes.array.isRequired,
|
||
|
setPeer: PropTypes.func.isRequired,
|
||
|
modalPeer: PropTypes.object,
|
||
|
peerModalOpen: PropTypes.bool.isRequired,
|
||
|
peerForm: PropTypes.object.isRequired,
|
||
|
setPeerForm: PropTypes.func.isRequired,
|
||
|
connect: PropTypes.func.isRequired,
|
||
|
disconnect: PropTypes.func.isRequired
|
||
8 years ago
|
}
|
||
|
|
||
8 years ago
|
export default Peers
|