2017-06-06 23:19:12 +02:00
|
|
|
import React from "react";
|
2017-09-11 03:25:24 +02:00
|
|
|
import { Form, FormRow, Submit } from "component/form";
|
2017-09-01 08:14:38 +02:00
|
|
|
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() {
|
|
|
|
const {
|
|
|
|
closeModal,
|
|
|
|
modal,
|
|
|
|
setAmount,
|
|
|
|
setAddress,
|
|
|
|
amount,
|
|
|
|
address,
|
|
|
|
error,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<section className="card">
|
|
|
|
<Form onSubmit={this.handleSubmit.bind(this)}>
|
|
|
|
<div className="card__title-primary">
|
|
|
|
<h3>{__("Send Credits")}</h3>
|
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
|
|
|
<FormRow
|
|
|
|
label={__("Amount")}
|
|
|
|
postfix={__("LBC")}
|
|
|
|
step="0.01"
|
|
|
|
min="0"
|
|
|
|
type="number"
|
|
|
|
placeholder="1.23"
|
|
|
|
size="10"
|
|
|
|
onChange={setAmount}
|
|
|
|
value={amount}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
|
|
|
<FormRow
|
|
|
|
label={__("Recipient Address")}
|
|
|
|
placeholder="bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs"
|
|
|
|
type="text"
|
|
|
|
size="60"
|
|
|
|
onChange={setAddress}
|
|
|
|
value={address}
|
|
|
|
regexp={lbryuri.REGEXP_ADDRESS}
|
|
|
|
trim={true}
|
2017-08-26 05:21:26 +02:00
|
|
|
/>
|
2017-09-11 03:25:24 +02:00
|
|
|
<div className="form-row-submit">
|
|
|
|
<Submit
|
|
|
|
label={__("Send")}
|
|
|
|
disabled={!(parseFloat(amount) > 0.0) || !address}
|
|
|
|
/>
|
|
|
|
</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;
|