2017-07-27 16:48:18 +02:00
|
|
|
import React from "react";
|
|
|
|
import Link from "component/link";
|
2017-08-25 20:03:33 +02:00
|
|
|
import { FormRow } from "component/form";
|
2017-07-27 16:48:18 +02:00
|
|
|
|
|
|
|
class TipLink extends React.PureComponent {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
2017-08-25 20:41:31 +02:00
|
|
|
tipAmount: 1.0,
|
2017-07-27 16:48:18 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-08-08 00:13:58 +02:00
|
|
|
handleSendButtonClicked() {
|
|
|
|
let claim_id = this.props.claim_id;
|
2017-08-25 20:03:33 +02:00
|
|
|
let amount = this.state.tipAmount;
|
2017-08-14 11:43:40 +02:00
|
|
|
this.props.sendSupport(amount, claim_id);
|
2017-07-28 01:34:42 +02:00
|
|
|
this.props.onTipHide();
|
2017-07-27 16:48:18 +02:00
|
|
|
}
|
|
|
|
|
2017-08-08 00:13:58 +02:00
|
|
|
handleSupportCancelButtonClicked() {
|
2017-07-28 01:34:42 +02:00
|
|
|
this.props.onTipHide();
|
2017-07-27 16:48:18 +02:00
|
|
|
}
|
|
|
|
|
2017-08-25 20:03:33 +02:00
|
|
|
handleSupportPriceChange(event) {
|
2017-07-27 16:48:18 +02:00
|
|
|
this.setState({
|
2017-08-25 20:41:31 +02:00
|
|
|
tipAmount: Number(event.target.value),
|
2017-07-29 08:50:17 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-07-27 16:48:18 +02:00
|
|
|
render() {
|
|
|
|
return (
|
2017-08-25 20:03:33 +02:00
|
|
|
<div className="card__content">
|
|
|
|
<div className="card__title-primary">
|
2017-09-04 19:35:41 +02:00
|
|
|
<h4>{__("Support")}</h4>
|
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
|
|
|
{__(
|
|
|
|
"Support the creator and the success of their content by sending a tip. "
|
|
|
|
)}
|
|
|
|
<Link label={__("Learn more")} href="https://lbry.io/faq/tipping" />
|
2017-08-25 20:03:33 +02:00
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
|
|
|
<FormRow
|
|
|
|
label={__("Amount")}
|
|
|
|
postfix={__("LBC")}
|
|
|
|
min="0"
|
|
|
|
step="0.1"
|
|
|
|
type="number"
|
|
|
|
placeholder="1.00"
|
|
|
|
onChange={event => this.handleSupportPriceChange(event)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="card__actions">
|
|
|
|
<Link
|
|
|
|
label={__("Send")}
|
|
|
|
button="primary"
|
|
|
|
onClick={this.handleSendButtonClicked.bind(this)}
|
|
|
|
/>
|
|
|
|
<Link
|
|
|
|
label={__("Cancel")}
|
|
|
|
button="alt"
|
|
|
|
onClick={this.handleSupportCancelButtonClicked.bind(this)}
|
|
|
|
/>
|
|
|
|
</div>
|
2017-07-27 18:55:51 +02:00
|
|
|
</div>
|
2017-07-27 16:48:18 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TipLink;
|