import React, { Component } from 'react' import PropTypes from 'prop-types' import find from 'lodash/find' 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' import { btc } from 'utils' import LoadingBolt from 'components/LoadingBolt' 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, showPayLoadingScreen, payFormIsValid: { errors, isValid }, currentCurrencyFilters, currencyName, setPayAmount, onPayAmountBlur, setPayInput, onPayInputBlur, setCurrencyFilters, onPaySubmit, setCurrency } = this.props const displayNodeName = (pubkey) => { const node = find(nodes, n => n.pub_key === pubkey) if (node && node.alias.length) { return node.alias } return 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 (
{showPayLoadingScreen && }

Make Payment

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