import React from 'react' import PropTypes from 'prop-types' import ReactModal from 'react-modal' import { FaUser } from 'react-icons/lib/fa' import CurrencyIcon from 'components/CurrencyIcon' import { usd, btc } from 'utils' import styles from './ChannelForm.scss' const ChannelForm = ({ form, setForm, ticker, peers, openChannel, currentTicker }) => { const submitClicked = () => { const { node_key, local_amt, push_amt } = form const localamt = ticker.currency === 'usd' ? btc.btcToSatoshis(usd.usdToBtc(local_amt, currentTicker.price_usd)) : btc.btcToSatoshis(local_amt) const pushamt = ticker.currency === 'usd' ? btc.btcToSatoshis(usd.usdToBtc(push_amt, currentTicker.price_usd)) : btc.btcToSatoshis(push_amt) openChannel({ pubkey: node_key, localamt, pushamt }) // setForm({ isOpen: false }) } const customStyles = { overlay: { cursor: 'pointer', overflowY: 'auto' }, content: { top: 'auto', left: '20%', right: '0', bottom: 'auto', width: '40%', margin: '50px auto', padding: '40px' } } return (
setForm({ isOpen: false })} parentSelector={() => document.body} style={customStyles} >

Open a new channel

setForm({ node_key: event.target.value })} id='nodekey' />
setForm({ local_amt: event.target.value })} id='localamount' />
setForm({ push_amt: event.target.value })} id='pushamount' />

    Connected Peers

    { peers.length ? peers.map(peer => (
  • setForm({ node_key: peer.pub_key })} >

    {peer.address}

    {peer.pub_key}

  • ) ) : null }
Submit
) } ChannelForm.propTypes = { form: PropTypes.object.isRequired, setForm: PropTypes.func.isRequired, ticker: PropTypes.object.isRequired, peers: PropTypes.array.isRequired, openChannel: PropTypes.func.isRequired, currentTicker: PropTypes.object.isRequired } export default ChannelForm