diff --git a/app/components/Form/Form.js b/app/components/Form/Form.js index 14a4f353..536b6a86 100644 --- a/app/components/Form/Form.js +++ b/app/components/Form/Form.js @@ -34,7 +34,9 @@ const Form = ({ formType, formProps, closeForm }) => { Form.propTypes = { - + formType: PropTypes.string, + formProps: PropTypes.object.isRequired, + closeForm: PropTypes.func.isRequired } export default Form diff --git a/app/components/Form/PayForm.js b/app/components/Form/PayForm.js index a3bf6b02..1bf8fb3f 100644 --- a/app/components/Form/PayForm.js +++ b/app/components/Form/PayForm.js @@ -106,7 +106,23 @@ class PayForm extends Component { PayForm.propTypes = { + payform: PropTypes.object.isRequired, + currency: PropTypes.string.isRequired, + crypto: PropTypes.string.isRequired, + isOnchain: PropTypes.bool.isRequired, + isLn: PropTypes.bool.isRequired, + currentAmount: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number + ]).isRequired, + inputCaption: PropTypes.string.isRequired, + showPayLoadingScreen: PropTypes.bool.isRequired, + + setPayAmount: PropTypes.func.isRequired, + setPayInput: PropTypes.func.isRequired, + + onPaySubmit: PropTypes.func.isRequired } export default PayForm diff --git a/app/reducers/invoice.js b/app/reducers/invoice.js index 33161913..479e0889 100644 --- a/app/reducers/invoice.js +++ b/app/reducers/invoice.js @@ -83,7 +83,10 @@ export const fetchInvoice = payreq => (dispatch) => { } // Receive IPC event for form invoice -export const receiveFormInvoice = (event, invoice) => dispatch => dispatch(setPayInvoice(invoice)) +export const receiveFormInvoice = (event, invoice) => dispatch => { + dispatch(setPayInvoice(invoice)) + dispatch({ type: RECEIVE_FORM_INVOICE }) +} // Send IPC event for invoices export const fetchInvoices = () => (dispatch) => { @@ -133,9 +136,7 @@ const ACTION_HANDLERS = { [GET_INVOICE]: state => ({ ...state, invoiceLoading: true }), [RECEIVE_INVOICE]: (state, { invoice }) => ({ ...state, invoiceLoading: false, invoice }), - [RECEIVE_FORM_INVOICE]: (state, { formInvoice }) => ( - { ...state, invoiceLoading: false, formInvoice } - ), + [RECEIVE_FORM_INVOICE]: state => ({ ...state, invoiceLoading: false }), [GET_INVOICES]: state => ({ ...state, invoiceLoading: true }), [RECEIVE_INVOICES]: (state, { invoices }) => ({ ...state, invoiceLoading: false, invoices }), diff --git a/app/reducers/payform.js b/app/reducers/payform.js index 488dc986..50f560be 100644 --- a/app/reducers/payform.js +++ b/app/reducers/payform.js @@ -121,7 +121,7 @@ payFormSelectors.inputCaption = createSelector( payAmountSelector, currencySelector, (isOnchain, isLn, amount, currency) => { - if (!isOnchain && !isLn) { return } + if (!isOnchain && !isLn) { return '' } if (isOnchain) { return `You're about to send ${amount} ${currency.toUpperCase()} on-chain which should take around 10 minutes` diff --git a/app/routes/app/containers/AppContainer.js b/app/routes/app/containers/AppContainer.js index c8a25655..9f3ccab6 100644 --- a/app/routes/app/containers/AppContainer.js +++ b/app/routes/app/containers/AppContainer.js @@ -128,15 +128,15 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { ...dispatchProps, ...ownProps, + // Props to pass to the pay form + formProps: formProps(stateProps.form.formType), // action to open the pay form openPayForm: () => dispatchProps.setFormType('PAY_FORM'), // action to open the request form openRequestForm: () => dispatchProps.setFormType('REQUEST_FORM'), // action to close form - closeForm: () => dispatchProps.setFormType(null), + closeForm: () => dispatchProps.setFormType(null) - // Props to pass to the pay form - formProps: formProps(stateProps.form.formType) } }