Merge pull request #324 from hackrush01/hackrush

Added max_key_fee setting
This commit is contained in:
Jeremy Kauffman 2017-07-25 10:10:19 -04:00 committed by GitHub
commit 0d4218d6f9

View file

@ -55,6 +55,32 @@ class SettingsPage extends React.PureComponent {
this.setDaemonSetting("download_directory", event.target.value);
}
onKeyFeeChange(event) {
var oldSettings = this.props.daemonSettings.max_key_fee;
var newSettings = {
amount: oldSettings.amount,
currency: oldSettings.currency,
};
newSettings.amount = Number(event.target.value);
this.setDaemonSetting("max_key_fee", newSettings);
}
onFeeCurrencyChange(event) {
var oldSettings = this.props.daemonSettings.max_key_fee;
var newSettings = {
amount: oldSettings.amount,
currency: oldSettings.currency,
};
newSettings.currency = event.target.value;
this.setDaemonSetting("max_key_fee", newSettings);
}
onKeyFeeDisableChange(isDisabled) {
this.setDaemonSetting("disable_max_key_fee", isDisabled);
}
// onMaxUploadPrefChange(isLimited) {
// if (!isLimited) {
// this.setDaemonSetting("max_upload", 0.0);
@ -255,6 +281,68 @@ class SettingsPage extends React.PureComponent {
/>
</div>
</section>
<section className="card">
<div className="card__content">
<h3>{__("Max Purchase Price")}</h3>
</div>
<div className="card__content">
<div className="form-row__label-row">
<div className="form-field__label">{__("Max Purchase Price")}</div>
</div>
<FormRow
type="radio"
name="max_key_fee"
onClick={() => {
this.onKeyFeeDisableChange(true);
}}
defaultChecked={daemonSettings.disable_max_key_fee}
label={__("No Limit")}
/>
<div className="form-row">
<FormField
type="radio"
name="max_key_fee"
onClick={() => {
this.onKeyFeeDisableChange(false);
}}
defaultChecked={!daemonSettings.disable_max_key_fee}
label={
daemonSettings.disable_max_key_fee
? __("Choose limit")
: __("Limit to")
}
/>
{!daemonSettings.disable_max_key_fee
? <FormField
type="number"
min="0"
placeholder="50"
step="1"
onChange={this.onKeyFeeChange.bind(this)}
defaultValue={daemonSettings.max_key_fee.amount}
className="form-field__input--inline"
/>
: ""}
{!daemonSettings.disable_max_key_fee
? <FormField
type="select"
onChange={this.onFeeCurrencyChange.bind(this)}
defaultValue={daemonSettings.max_key_fee.currency}
className="form-field__input--inline"
>
<option value="USD">{__("US Dollars")}</option>
<option value="LBC">{__("LBRY credits")}</option>
</FormField>
: ""}
</div>
<div className="form-field__helper">
{__(
"This will prevent you from purchasing any content over this cost, as a safety measure."
)}
</div>
</div>
</section>
<section className="card">
<div className="card__content">
<h3>{__("Content")}</h3>