Added new component form for price, also only tipping form is shown when
clicked.
This commit is contained in:
parent
b8b3a6ffd2
commit
ba6d093d1c
4 changed files with 87 additions and 23 deletions
|
@ -14,6 +14,7 @@ class FileActions extends React.PureComponent {
|
|||
super(props);
|
||||
this.state = {
|
||||
forceShowActions: false,
|
||||
showTipBox: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -58,6 +59,18 @@ class FileActions extends React.PureComponent {
|
|||
this.props.loadVideo(this.props.uri);
|
||||
}
|
||||
|
||||
handleTipShow() {
|
||||
this.setState({
|
||||
showTipBox: true,
|
||||
});
|
||||
}
|
||||
|
||||
handleTipHide() {
|
||||
this.setState({
|
||||
showTipBox: false,
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
fileInfo,
|
||||
|
@ -76,6 +89,8 @@ class FileActions extends React.PureComponent {
|
|||
claimIsMine,
|
||||
} = this.props;
|
||||
|
||||
const { showTipBox } = this.state;
|
||||
|
||||
const metadata = fileInfo ? fileInfo.metadata : null,
|
||||
openInFolderMessage = platform.startsWith("Mac")
|
||||
? __("Open in Finder")
|
||||
|
@ -166,8 +181,14 @@ class FileActions extends React.PureComponent {
|
|||
|
||||
return (
|
||||
<section className="file-actions">
|
||||
{content}
|
||||
{showMenu
|
||||
{showTipBox ? "" : content}
|
||||
<TipLink
|
||||
onTipShow={this.handleTipShow.bind(this)}
|
||||
onTipHide={this.handleTipHide.bind(this)}
|
||||
showTipBox={showTipBox}
|
||||
claim={this.props.claim}
|
||||
/>
|
||||
{showMenu && !showTipBox
|
||||
? <DropDownMenu>
|
||||
<DropDownMenuItem
|
||||
key={0}
|
||||
|
@ -181,7 +202,6 @@ class FileActions extends React.PureComponent {
|
|||
/>
|
||||
</DropDownMenu>
|
||||
: ""}
|
||||
<TipLink claim={this.props.claim} />
|
||||
<Modal
|
||||
type="confirm"
|
||||
isOpen={modal == "affirmPurchase"}
|
||||
|
|
5
ui/js/component/priceForm/index.js
Normal file
5
ui/js/component/priceForm/index.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import PriceForm from "./view";
|
||||
|
||||
export default connect(null, null)(PriceForm);
|
39
ui/js/component/priceForm/view.jsx
Normal file
39
ui/js/component/priceForm/view.jsx
Normal file
|
@ -0,0 +1,39 @@
|
|||
import React from "react";
|
||||
import { FormField } from "component/form";
|
||||
|
||||
const PriceForm = props => {
|
||||
const {
|
||||
onFeeChange,
|
||||
onCurrencyChange,
|
||||
defaultFeeValue,
|
||||
defaultCurrencyValue,
|
||||
placeholder,
|
||||
min,
|
||||
step,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<span>
|
||||
<FormField
|
||||
type="number"
|
||||
min={min}
|
||||
placeholder={placeholder || null}
|
||||
step={step}
|
||||
onChange={onFeeChange}
|
||||
defaultValue={defaultFeeValue}
|
||||
className="form-field__input--inline"
|
||||
/>
|
||||
<FormField
|
||||
type="select"
|
||||
onChange={onCurrencyChange}
|
||||
defaultValue={defaultCurrencyValue}
|
||||
className="form-field__input--inline"
|
||||
>
|
||||
<option value="LBC">{__("LBRY credits")}</option>
|
||||
<option value="USD">{__("US Dollars")}</option>
|
||||
</FormField>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default PriceForm;
|
|
@ -1,21 +1,20 @@
|
|||
import React from "react";
|
||||
import Link from "component/link";
|
||||
import { FormField } from "component/form";
|
||||
import PriceForm from "component/priceForm";
|
||||
|
||||
class TipLink extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
showTipBox: false,
|
||||
feeAmount: "1.00",
|
||||
currency: "LBC",
|
||||
};
|
||||
}
|
||||
|
||||
handleTipPublisherButtonClicked() {
|
||||
this.setState({
|
||||
showTipBox: true,
|
||||
});
|
||||
this.props.onTipShow();
|
||||
}
|
||||
|
||||
handleTipButtonClicked() {
|
||||
|
@ -26,15 +25,11 @@ class TipLink extends React.PureComponent {
|
|||
this.props.setAmount(amount);
|
||||
this.props.sendToAddress();
|
||||
|
||||
this.setState({
|
||||
showTipBox: false,
|
||||
});
|
||||
this.props.onTipHide();
|
||||
}
|
||||
|
||||
handleTipCancelButtonClicked() {
|
||||
this.setState({
|
||||
showTipBox: false,
|
||||
});
|
||||
this.props.onTipHide();
|
||||
}
|
||||
|
||||
handleFeeAmountChange(event) {
|
||||
|
@ -43,12 +38,18 @@ class TipLink extends React.PureComponent {
|
|||
});
|
||||
}
|
||||
|
||||
handleCurrencyChange(event) {
|
||||
this.setState({
|
||||
currency: event.target.value,
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { showTipBox } = this.state;
|
||||
const { showTipBox } = this.props;
|
||||
|
||||
let tipLink = (
|
||||
<Link
|
||||
label={__("Tip Publisher")}
|
||||
label={__("Tip")}
|
||||
button="text"
|
||||
icon="icon-gift"
|
||||
onClick={this.handleTipPublisherButtonClicked.bind(this)}
|
||||
|
@ -57,15 +58,14 @@ class TipLink extends React.PureComponent {
|
|||
|
||||
let tipBox = (
|
||||
<span>
|
||||
<FormField
|
||||
type="number"
|
||||
className="form-field__input--inline"
|
||||
step="0.1"
|
||||
placeholder="1.00"
|
||||
defaultValue="1.00"
|
||||
<PriceForm
|
||||
min="0.01"
|
||||
postfix={__("LBC")}
|
||||
onChange={event => this.handleFeeAmountChange(event)}
|
||||
placeholder="1.00"
|
||||
step="0.1"
|
||||
onFeeChange={event => this.handleFeeAmountChange(event)}
|
||||
defaultFeeValue="1.00"
|
||||
onCurrencyChange={event => this.handleCurrencyChange(event)}
|
||||
defaultCurrencyValue="LBC"
|
||||
/>
|
||||
{__(" ")}
|
||||
<Link
|
||||
|
|
Loading…
Add table
Reference in a new issue