import React, { Component } from 'react' import PropTypes from 'prop-types' import Isvg from 'react-inlinesvg' import paperPlane from 'icons/paper_plane.svg' import link from 'icons/link.svg' import FaAngleDown from 'react-icons/lib/fa/angle-down' import { btc } from 'utils' import styles from './Pay.scss' class Pay extends Component { componentDidUpdate(prevProps) { const { isOnchain, isLn, payform: { payInput }, fetchInvoice } = this.props // If on-chain, focus on amount to let user know it's editable if (isOnchain) { this.amountInput.focus() } // If LN go retrieve invoice details if (prevProps.payform.payInput !== payInput && isLn) { fetchInvoice(payInput) } } render() { const { payform: { payInput, showErrors, invoice, showCurrencyFilters }, nodes, ticker, isOnchain, isLn, currentAmount, usdAmount, payFormIsValid: { errors, isValid }, currentCurrencyFilters, currencyName, setPayAmount, onPayAmountBlur, setPayInput, onPayInputBlur, setCurrencyFilters, onPaySubmit, setCurrency } = this.props const displayNodeName = pubkey => { const node = nodes.find(n => n.pub_key === pubkey) if (node && node.alias.length) { return node.alias } return pubkey ? pubkey.substring(0, 10) : '' } const onCurrencyFilterClick = currency => { if (!isLn) { // change the input amount setPayAmount(btc.convert(ticker.currency, currency, currentAmount)) } setCurrency(currency) setCurrencyFilters(false) } return (

Make Payment

{isOnchain && ( On-Chain (~10 minutes) )} {isLn && ( {displayNodeName(invoice.destination)} ({invoice.description}) )}