From 145899aa6bf2257dc653693921ec34a68b549b7e Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Fri, 2 Nov 2018 12:51:49 +0100 Subject: [PATCH] refactor: remove old pay forms --- app/components/Form/Pay/Pay.js | 217 ---------------------- app/components/Form/Pay/Pay.scss | 122 ------------- app/components/Form/Pay/index.js | 3 - app/components/Form/Pay/messages.js | 11 -- app/containers/Activity.js | 3 +- app/containers/App.js | 97 +--------- app/reducers/index.js | 2 - app/reducers/invoice.js | 7 - app/reducers/ipc.js | 9 +- app/reducers/payform.js | 268 ---------------------------- app/reducers/payment.js | 15 +- app/reducers/requestform.js | 2 +- app/reducers/transaction.js | 4 - test/unit/components/Form.spec.js | 41 +---- 14 files changed, 15 insertions(+), 786 deletions(-) delete mode 100644 app/components/Form/Pay/Pay.js delete mode 100644 app/components/Form/Pay/Pay.scss delete mode 100644 app/components/Form/Pay/index.js delete mode 100644 app/components/Form/Pay/messages.js delete mode 100644 app/reducers/payform.js diff --git a/app/components/Form/Pay/Pay.js b/app/components/Form/Pay/Pay.js deleted file mode 100644 index 0f7779f1..00000000 --- a/app/components/Form/Pay/Pay.js +++ /dev/null @@ -1,217 +0,0 @@ -import React, { Component } from 'react' -import PropTypes from 'prop-types' -import { btc } from 'lib/utils' -import PaperPlane from 'components/Icon/PaperPlane' -import ChainLink from 'components/Icon/ChainLink' -import AmountInput from 'components/AmountInput' -import { Button, Dropdown } from 'components/UI' -import { FormattedNumber, FormattedMessage, injectIntl } from 'react-intl' -import messages from './messages' -import styles from './Pay.scss' - -class Pay extends Component { - constructor(props) { - super(props) - this.paymentRequestInput = React.createRef() - } - - componentDidMount() { - const { setPayInput, setPayAmount } = this.props - - // Clear the form of any previous data. - setPayInput('') - setPayAmount('') - - // Focus the payment request input field. - this.paymentRequestInput.current.focus() - } - - componentDidUpdate(prevProps) { - const { - isLn, - payform: { payInput }, - fetchInvoice - } = this.props - - // If LN go retrieve invoice details - if (prevProps.payform.payInput !== payInput && isLn) { - fetchInvoice(payInput) - } - } - - render() { - const { - payform: { payInput, showErrors, invoice }, - nodes, - ticker, - isOnchain, - isLn, - currentAmount, - fiatAmount, - payFormIsValid: { errors, isValid }, - currencyFilters, - setPayAmount, - onPayAmountBlur, - setPayInput, - onPayInputBlur, - onPaySubmit, - setCurrency, - intl - } = 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) - } - - return ( -
-
- -

- -

-
- -
-
-
- - - {isOnchain && ( - - - - - - - )} - {isLn && ( - - - {displayNodeName(invoice.destination)} ({invoice.description}) - - - )} - -
-
-