2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { Form, FormRow, Submit } from 'component/form';
|
|
|
|
import lbryuri from 'lbryuri';
|
2017-05-11 02:59:47 +02:00
|
|
|
|
2017-09-11 03:25:24 +02:00
|
|
|
class WalletSend extends React.PureComponent {
|
|
|
|
handleSubmit() {
|
|
|
|
const { amount, address, sendToAddress } = this.props;
|
|
|
|
const validSubmit = parseFloat(amount) > 0.0 && address;
|
2017-05-11 02:59:47 +02:00
|
|
|
|
2017-09-11 03:25:24 +02:00
|
|
|
if (validSubmit) {
|
|
|
|
sendToAddress();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-12-21 22:08:54 +01:00
|
|
|
const { closeModal, modal, setAmount, setAddress, amount, address, error } = this.props;
|
2017-09-11 03:25:24 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<section className="card">
|
|
|
|
<Form onSubmit={this.handleSubmit.bind(this)}>
|
|
|
|
<div className="card__title-primary">
|
2017-12-21 22:08:54 +01:00
|
|
|
<h3>{__('Send Credits')}</h3>
|
2017-09-11 03:25:24 +02:00
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
|
|
|
<FormRow
|
2017-12-21 22:08:54 +01:00
|
|
|
label={__('Amount')}
|
|
|
|
postfix={__('LBC')}
|
2017-09-29 22:51:36 +02:00
|
|
|
step="any"
|
2017-09-11 03:25:24 +02:00
|
|
|
min="0"
|
|
|
|
type="number"
|
|
|
|
placeholder="1.23"
|
|
|
|
size="10"
|
|
|
|
onChange={setAmount}
|
|
|
|
value={amount}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
|
|
|
<FormRow
|
2017-12-21 22:08:54 +01:00
|
|
|
label={__('Recipient Address')}
|
2017-09-11 03:25:24 +02:00
|
|
|
placeholder="bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs"
|
|
|
|
type="text"
|
|
|
|
size="60"
|
|
|
|
onChange={setAddress}
|
|
|
|
value={address}
|
|
|
|
regexp={lbryuri.REGEXP_ADDRESS}
|
2017-12-21 22:08:54 +01:00
|
|
|
trim
|
2017-08-26 05:21:26 +02:00
|
|
|
/>
|
2017-09-11 03:25:24 +02:00
|
|
|
<div className="form-row-submit">
|
2017-12-21 22:08:54 +01:00
|
|
|
<Submit label={__('Send')} disabled={!(parseFloat(amount) > 0.0) || !address} />
|
2017-09-11 03:25:24 +02:00
|
|
|
</div>
|
2017-08-26 05:21:26 +02:00
|
|
|
</div>
|
2017-09-11 03:25:24 +02:00
|
|
|
</Form>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2017-05-11 02:59:47 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export default WalletSend;
|