lbry-desktop/ui/js/component/walletSend/view.jsx
btzr-io b7b8851698 fix #542
implement submit component

fix weird behaviour in wallet send

prevent refresh on enter key

fix wallet send ->  submit handler

implement form component

fix conflicts

remove unused files

better submit handler

better validation for walletSend

prevent / remove missign parameters error (popup)

minor fix

minor fix for submit validation in walletSend
2017-09-18 18:10:20 -04:00

69 lines
1.7 KiB
JavaScript

import React from "react";
import { Form, FormRow, Submit } from "component/form";
import lbryuri from "lbryuri";
class WalletSend extends React.PureComponent {
handleSubmit() {
const { amount, address, sendToAddress } = this.props;
const validSubmit = parseFloat(amount) > 0.0 && address;
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}
/>
<div className="form-row-submit">
<Submit
label={__("Send")}
disabled={!(parseFloat(amount) > 0.0) || !address}
/>
</div>
</div>
</Form>
</section>
);
}
}
export default WalletSend;