import React from 'react' import PropTypes from 'prop-types' import ReactModal from 'react-modal' import { MdClose } from 'react-icons/lib/md' import { FaCircle } from 'react-icons/lib/fa' import styles from './ContactsForm.scss' class ContactsForm extends React.Component { constructor(props) { super(props) this.state = { editing: false, manualFormInput: '' } } render() { const { contactsform, closeContactsForm, updateContactFormSearchQuery, updateContactCapacity, openChannel, activeChannelPubkeys, nonActiveChannelPubkeys, pendingOpenChannelPubkeys, filteredNetworkNodes, loadingChannelPubkeys, showManualForm } = this.props const { editing, manualFormInput } = this.state const renderRightSide = (node) => { if (loadingChannelPubkeys.includes(node.pub_key)) { return (
) } if (activeChannelPubkeys.includes(node.pub_key)) { return ( Online ) } if (nonActiveChannelPubkeys.includes(node.pub_key)) { return ( Offline ) } if (pendingOpenChannelPubkeys.includes(node.pub_key)) { return ( Pending ) } if (!node.addresses.length) { return ( Private ) } return ( openChannel({ pubkey: node.pub_key, host: node.addresses[0].addr, local_amt: contactsform.contactCapacity })} > Connect ) } const inputClicked = () => { if (editing) { return } this.setState({ editing: true }) } const manualFormSubmit = () => { if (!manualFormInput.length) { return } if (!manualFormInput.includes('@')) { return } const [pubkey, host] = manualFormInput && manualFormInput.split('@') openChannel({ pubkey, host, local_amt: contactsform.contactCapacity }) this.setState({ manualFormInput: '' }) } return (
closeContactsForm} parentSelector={() => document.body} className={styles.modal} >

Add Contact

updateContactFormSearchQuery(event.target.value)} autoFocus />
    { contactsform.searchQuery.length > 0 && filteredNetworkNodes.map(node => { return (
  • { node.alias.length > 0 ?

    {node.alias.trim()} ({node.pub_key.substr(0, 10)}...{node.pub_key.substr(node.pub_key.length - 10)})

    :

    {node.pub_key}

    }
    {renderRightSide(node)}
  • ) }) }
{ showManualForm &&

Hm, looks like we can't see that contact from here. Want to try and manually connect?

this.setState({ manualFormInput: event.target.value })} />
Submit
}
) } } ContactsForm.propTypes = { } export default ContactsForm