diff --git a/app/reducers/form.js b/app/reducers/form.js index b91610bf..78425466 100644 --- a/app/reducers/form.js +++ b/app/reducers/form.js @@ -1,8 +1,8 @@ // Initial State const initialState = { - modalOpen: true, + modalOpen: false, formType: 'pay', - paymentType: 'onchain', + paymentType: '', amount: '0', message: '', pubkey: '', diff --git a/app/routes/app/components/components/Form/Form.js b/app/routes/app/components/components/Form/Form.js index d3b6ae04..2e241816 100644 --- a/app/routes/app/components/components/Form/Form.js +++ b/app/routes/app/components/components/Form/Form.js @@ -34,7 +34,9 @@ const Form = ({ { setPaymentRequest(payreq) - if (payreq.length === 124) { fetchInvoice(payreq) } + if (payreq.length === 124) { + setPaymentType('ln') + fetchInvoice(payreq) + } else if (payreq.length === 42) { + setPaymentType('onchain') + } else { + setPaymentType('') + } } const calculateAmount = value => (currency === 'usd' ? btc.satoshisToUsd(value, currentTicker.price_usd) : btc.satoshisToBtc(value)) + console.log('paymentType: ', paymentType) + console.log('onchainAmount: ', onchainAmount) return (
-
+
1 ? (onchainAmount.length * 15) - 5 : 25}%`, fontSize: `${190 - (onchainAmount.length ** 2)}px` } + } + value={paymentType === 'ln' ? calculateAmount(invoiceAmount) : onchainAmount} + onChange={event => setAmount(event.target.value)} id='amount' - readOnly + readOnly={paymentType === 'ln'} />
-
setPaymentType('onchain')} - > - -
- - paymentRequestOnChange(event.target.value)} - id='paymentRequest' - /> -
-
-
-
setPaymentType('ln')} - > -