lbry-desktop/ui/js/page/publish/view.jsx

914 lines
27 KiB
React
Raw Normal View History

2017-06-06 23:19:12 +02:00
import React from "react";
import lbry from "lbry";
import lbryuri from "lbryuri";
import { FormField, FormRow } from "component/form.js";
import Link from "component/link";
import rewards from "rewards";
import Modal from "component/modal";
2016-11-22 21:19:08 +01:00
2017-06-08 06:42:19 +02:00
class PublishPage extends React.PureComponent {
2017-05-17 10:10:25 +02:00
constructor(props) {
super(props);
2017-06-06 23:19:12 +02:00
this._requiredFields = ["meta_title", "name", "bid", "tos_agree"];
2017-05-17 10:10:25 +02:00
this.state = {
channels: null,
2017-06-06 23:19:12 +02:00
rawName: "",
name: "",
2017-05-17 10:10:25 +02:00
bid: 10,
hasFile: false,
2017-06-06 23:19:12 +02:00
feeAmount: "",
feeCurrency: "USD",
channel: "anonymous",
newChannelName: "@",
2017-05-17 10:10:25 +02:00
newChannelBid: 10,
nameResolved: null,
myClaimExists: null,
topClaimValue: 0.0,
myClaimValue: 0.0,
myClaimMetadata: null,
2017-06-06 23:19:12 +02:00
copyrightNotice: "",
otherLicenseDescription: "",
otherLicenseUrl: "",
2017-05-17 10:10:25 +02:00
uploadProgress: 0.0,
uploaded: false,
errorMessage: null,
submitting: false,
creatingChannel: false,
modal: null,
};
}
_updateChannelList(channel) {
// Calls API to update displayed list of channels. If a channel name is provided, will select
// that channel at the same time (used immediately after creating a channel)
2017-06-06 23:19:12 +02:00
lbry.channel_list_mine().then(channels => {
2017-06-08 23:15:34 +02:00
this.props.claimFirstChannelReward();
this.setState({
channels: channels,
2017-06-06 23:19:12 +02:00
...(channel ? { channel } : {}),
});
});
2017-05-17 10:10:25 +02:00
}
handleSubmit(event) {
2017-06-06 23:19:12 +02:00
if (typeof event !== "undefined") {
2016-10-19 08:36:42 +02:00
event.preventDefault();
}
this.setState({
submitting: true,
});
2017-04-12 16:55:19 +02:00
let checkFields = this._requiredFields;
if (!this.state.myClaimExists) {
2017-06-06 23:19:12 +02:00
checkFields.unshift("file");
}
2017-04-12 16:55:19 +02:00
let missingFieldFound = false;
for (let fieldName of checkFields) {
2017-04-12 16:55:19 +02:00
const field = this.refs[fieldName];
if (field) {
2017-06-06 23:19:12 +02:00
if (field.getValue() === "" || field.getValue() === false) {
2017-04-12 16:55:19 +02:00
field.showRequiredError();
if (!missingFieldFound) {
field.focus();
missingFieldFound = true;
}
} else {
field.clearError();
}
}
}
if (missingFieldFound) {
this.setState({
submitting: false,
});
return;
}
if (this.state.nameIsMine) {
// Pre-populate with existing metadata
var metadata = Object.assign({}, this.state.myClaimMetadata);
2017-06-06 23:19:12 +02:00
if (this.refs.file.getValue() !== "") {
delete metadata.sources;
}
} else {
var metadata = {};
}
2017-06-06 23:19:12 +02:00
for (let metaField of [
"title",
"description",
"thumbnail",
"license",
"license_url",
"language",
]) {
var value = this.refs["meta_" + metaField].getValue();
if (value !== "") {
metadata[metaField] = value;
}
}
2017-05-23 21:51:47 +02:00
metadata.nsfw = parseInt(this.refs.meta_nsfw.getValue()) === 1;
const licenseUrl = this.refs.meta_license_url.getValue();
if (licenseUrl) {
metadata.license_url = licenseUrl;
}
var doPublish = () => {
var publishArgs = {
name: this.state.name,
bid: parseFloat(this.state.bid),
metadata: metadata,
2017-06-06 23:19:12 +02:00
...(this.state.channel != "new" && this.state.channel != "anonymous"
? { channel_name: this.state.channel }
: {}),
};
2017-06-06 23:19:12 +02:00
if (this.refs.file.getValue() !== "") {
publishArgs.file_path = this.refs.file.getValue();
}
2017-04-10 14:32:40 +02:00
2017-06-15 02:21:31 +02:00
lbry.publishDeprecated(
2017-06-06 23:19:12 +02:00
publishArgs,
message => {
this.handlePublishStarted();
},
null,
error => {
this.handlePublishError(error);
}
);
};
if (this.state.isFee) {
2017-06-06 23:19:12 +02:00
lbry.wallet_unused_address().then(address => {
2017-06-06 17:14:08 +02:00
metadata.fee = {
currency: this.state.feeCurrency,
amount: parseFloat(this.state.feeAmount),
address: address,
};
doPublish();
});
} else {
doPublish();
}
2017-05-17 10:10:25 +02:00
}
handlePublishStarted() {
this.setState({
2017-06-06 23:19:12 +02:00
modal: "publishStarted",
});
2017-05-17 10:10:25 +02:00
}
handlePublishStartedConfirmed() {
2017-06-06 23:19:12 +02:00
this.props.navigate("/published");
2017-05-17 10:10:25 +02:00
}
handlePublishError(error) {
this.setState({
submitting: false,
2017-06-06 23:19:12 +02:00
modal: "error",
errorMessage: error.message,
});
2017-05-17 10:10:25 +02:00
}
handleNameChange(event) {
var rawName = event.target.value;
2016-07-15 14:04:47 +02:00
if (!rawName) {
2016-07-15 14:04:47 +02:00
this.setState({
2017-06-06 23:19:12 +02:00
rawName: "",
name: "",
2016-07-15 14:04:47 +02:00
nameResolved: false,
});
2016-07-15 14:04:47 +02:00
return;
}
if (!lbryuri.isValidName(rawName, false)) {
2017-06-06 23:19:12 +02:00
this.refs.name.showError(
__("LBRY names must contain only letters, numbers and dashes.")
);
return;
}
const name = rawName.toLowerCase();
this.setState({
rawName: rawName,
name: name,
nameResolved: null,
myClaimExists: null,
});
2017-06-06 23:19:12 +02:00
const myClaimInfo = Object.values(this.props.myClaims).find(
claim => claim.name === name
);
this.setState({
myClaimExists: !!myClaimInfo,
});
2017-06-06 23:19:12 +02:00
lbry.resolve({ uri: name }).then(
claimInfo => {
if (name != this.state.name) {
return;
}
2017-06-06 23:19:12 +02:00
if (!claimInfo) {
this.setState({
nameResolved: false,
});
} else {
const topClaimIsMine =
myClaimInfo && myClaimInfo.amount >= claimInfo.amount;
const newState = {
nameResolved: true,
topClaimValue: parseFloat(claimInfo.amount),
myClaimExists: !!myClaimInfo,
myClaimValue: myClaimInfo ? parseFloat(myClaimInfo.amount) : null,
myClaimMetadata: myClaimInfo ? myClaimInfo.value : null,
topClaimIsMine: topClaimIsMine,
};
if (topClaimIsMine) {
newState.bid = myClaimInfo.amount;
} else if (this.state.myClaimMetadata) {
// Just changed away from a name we have a claim on, so clear pre-fill
newState.bid = "";
}
this.setState(newState);
}
},
() => {
// Assume an error means the name is available
2017-04-11 06:12:34 +02:00
this.setState({
2017-06-06 23:19:12 +02:00
name: name,
2017-04-11 06:12:34 +02:00
nameResolved: false,
2017-06-06 23:19:12 +02:00
myClaimExists: false,
2016-07-15 14:04:47 +02:00
});
}
2017-06-06 23:19:12 +02:00
);
2017-05-17 10:10:25 +02:00
}
handleBidChange(event) {
2016-07-15 14:04:47 +02:00
this.setState({
bid: event.target.value,
2016-07-15 14:04:47 +02:00
});
2017-05-17 10:10:25 +02:00
}
handleFeeAmountChange(event) {
2016-07-15 14:04:47 +02:00
this.setState({
feeAmount: event.target.value,
});
2017-05-17 10:10:25 +02:00
}
handleFeeCurrencyChange(event) {
this.setState({
feeCurrency: event.target.value,
});
2017-05-17 10:10:25 +02:00
}
handleFeePrefChange(feeEnabled) {
this.setState({
2017-06-06 23:19:12 +02:00
isFee: feeEnabled,
2016-07-15 14:04:47 +02:00
});
2017-05-17 10:10:25 +02:00
}
handleLicenseChange(event) {
2017-06-06 23:19:12 +02:00
var licenseType = event.target.options[
event.target.selectedIndex
].getAttribute("data-license-type");
2016-09-20 12:40:24 +02:00
var newState = {
2017-06-06 23:19:12 +02:00
copyrightChosen: licenseType == "copyright",
otherLicenseChosen: licenseType == "other",
2016-09-20 12:40:24 +02:00
};
2017-06-06 23:19:12 +02:00
if (licenseType == "copyright") {
newState.copyrightNotice = __("All rights reserved.");
2016-09-20 12:40:24 +02:00
}
this.setState(newState);
2017-05-17 10:10:25 +02:00
}
handleCopyrightNoticeChange(event) {
2016-09-20 12:40:24 +02:00
this.setState({
copyrightNotice: event.target.value,
});
2017-05-17 10:10:25 +02:00
}
handleOtherLicenseDescriptionChange(event) {
2016-09-20 12:40:24 +02:00
this.setState({
otherLicenseDescription: event.target.value,
});
2017-05-17 10:10:25 +02:00
}
handleOtherLicenseUrlChange(event) {
2016-09-20 12:40:24 +02:00
this.setState({
otherLicenseUrl: event.target.value,
});
2017-05-17 10:10:25 +02:00
}
handleChannelChange(event) {
const channel = event.target.value;
this.setState({
channel: channel,
});
2017-05-17 10:10:25 +02:00
}
handleNewChannelNameChange(event) {
2017-06-06 23:19:12 +02:00
const newChannelName = event.target.value.startsWith("@")
? event.target.value
: "@" + event.target.value;
if (
newChannelName.length > 1 &&
!lbryuri.isValidName(newChannelName.substr(1), false)
) {
this.refs.newChannelName.showError(
__("LBRY channel names must contain only letters, numbers and dashes.")
);
return;
2017-04-12 16:55:19 +02:00
} else {
2017-06-06 23:19:12 +02:00
this.refs.newChannelName.clearError();
}
this.setState({
newChannelName: newChannelName,
});
2017-05-17 10:10:25 +02:00
}
handleNewChannelBidChange(event) {
this.setState({
newChannelBid: event.target.value,
});
2017-05-17 10:10:25 +02:00
}
handleTOSChange(event) {
this.setState({
TOSAgreed: event.target.checked,
});
2017-05-17 10:10:25 +02:00
}
handleCreateChannelClick(event) {
if (this.state.newChannelName.length < 5) {
2017-06-06 23:19:12 +02:00
this.refs.newChannelName.showError(
__("LBRY channel names must be at least 4 characters in length.")
);
return;
}
this.setState({
creatingChannel: true,
});
const newChannelName = this.state.newChannelName;
2017-06-06 23:19:12 +02:00
lbry
.channel_new({
channel_name: newChannelName,
2017-06-09 01:25:42 +02:00
amount: parseFloat(this.state.newChannelBid),
2017-06-06 23:19:12 +02:00
})
.then(
() => {
setTimeout(() => {
this.setState({
creatingChannel: false,
});
this._updateChannelList(newChannelName);
}, 5000);
},
error => {
// TODO: better error handling
this.refs.newChannelName.showError(
__("Unable to create channel due to an internal error.")
);
this.setState({
creatingChannel: false,
});
}
);
2017-05-17 10:10:25 +02:00
}
getLicenseUrl() {
2016-09-20 12:40:24 +02:00
if (!this.refs.meta_license) {
2017-06-06 23:19:12 +02:00
return "";
2016-09-20 12:40:24 +02:00
} else if (this.state.otherLicenseChosen) {
return this.state.otherLicenseUrl;
} else {
2017-06-06 23:19:12 +02:00
return (
this.refs.meta_license.getSelectedElement().getAttribute("data-url") ||
""
);
2016-09-20 12:40:24 +02:00
}
2017-05-17 10:10:25 +02:00
}
componentWillMount() {
this.props.fetchClaimListMine();
this._updateChannelList();
2017-05-17 10:10:25 +02:00
}
onFileChange() {
2017-04-10 20:12:07 +02:00
if (this.refs.file.getValue()) {
2017-06-06 23:19:12 +02:00
this.setState({ hasFile: true });
2017-04-10 20:12:07 +02:00
} else {
2017-06-06 23:19:12 +02:00
this.setState({ hasFile: false });
2017-04-10 20:12:07 +02:00
}
2017-05-17 10:10:25 +02:00
}
getNameBidHelpText() {
2017-04-10 20:12:07 +02:00
if (!this.state.name) {
2017-05-22 14:29:30 +02:00
return __("Select a URL for this publish.");
} else if (this.state.nameResolved === false) {
2017-05-22 14:29:30 +02:00
return __("This URL is unused.");
2017-04-10 20:12:07 +02:00
} else if (this.state.myClaimExists) {
2017-06-06 23:19:12 +02:00
return __(
"You have already used this URL. Publishing to it again will update your previous publish."
);
2017-04-10 20:12:07 +02:00
} else if (this.state.topClaimValue) {
2017-06-06 23:19:12 +02:00
return (
<span>
{__n(
'A deposit of at least "%s" credit is required to win "%s". However, you can still get a permanent URL for any amount.',
'A deposit of at least "%s" credits is required to win "%s". However, you can still get a permanent URL for any amount.',
this.state.topClaimValue /*pluralization param*/,
this.state.topClaimValue,
this.state.name /*regular params*/
)}
</span>
);
2017-04-10 20:12:07 +02:00
} else {
2017-06-06 23:19:12 +02:00
return "";
2017-04-10 20:12:07 +02:00
}
2017-05-17 10:10:25 +02:00
}
closeModal() {
2017-04-12 16:55:19 +02:00
this.setState({
modal: null,
});
2017-05-17 10:10:25 +02:00
}
render() {
if (this.state.channels === null) {
return null;
}
2017-06-06 23:19:12 +02:00
const lbcInputHelp = __(
"This LBC remains yours and the deposit can be undone at any time."
);
2017-04-12 16:55:19 +02:00
2016-05-23 17:14:21 +02:00
return (
<main className="main--single-column">
2017-06-06 23:19:12 +02:00
<form
onSubmit={event => {
this.handleSubmit(event);
}}
>
<section className="card">
2017-04-10 14:32:40 +02:00
<div className="card__title-primary">
2017-05-22 14:29:30 +02:00
<h4>{__("Content")}</h4>
2017-04-10 20:12:07 +02:00
<div className="card__subtitle">
2017-05-22 14:29:30 +02:00
{__("What are you publishing?")}
2017-04-10 20:12:07 +02:00
</div>
2017-04-10 14:32:40 +02:00
</div>
<div className="card__content">
2017-06-06 23:19:12 +02:00
<FormRow
name="file"
label="File"
ref="file"
type="file"
onChange={event => {
this.onFileChange(event);
}}
helper={
this.state.myClaimExists
? __(
"If you don't choose a file, the file from your existing claim will be used."
)
: null
}
/>
</div>
2017-06-06 23:19:12 +02:00
{!this.state.hasFile
? ""
: <div>
<div className="card__content">
<FormRow
label={__("Title")}
type="text"
ref="meta_title"
name="title"
placeholder={__("Title")}
/>
</div>
<div className="card__content">
<FormRow
type="text"
label={__("Thumbnail URL")}
ref="meta_thumbnail"
name="thumbnail"
placeholder="http://spee.ch/mylogo"
/>
</div>
<div className="card__content">
<FormRow
label={__("Description")}
type="textarea"
ref="meta_description"
name="description"
placeholder={__("Description of your content")}
/>
</div>
<div className="card__content">
<FormRow
label={__("Language")}
type="select"
defaultValue="en"
ref="meta_language"
name="language"
>
<option value="en">{__("English")}</option>
<option value="zh">{__("Chinese")}</option>
<option value="fr">{__("French")}</option>
<option value="de">{__("German")}</option>
<option value="jp">{__("Japanese")}</option>
<option value="ru">{__("Russian")}</option>
<option value="es">{__("Spanish")}</option>
</FormRow>
</div>
<div className="card__content">
<FormRow
type="select"
label={__("Maturity")}
defaultValue="en"
ref="meta_nsfw"
name="nsfw"
>
{/* <option value=""></option> */}
<option value="0">{__("All Ages")}</option>
<option value="1">{__("Adults Only")}</option>
</FormRow>
</div>
</div>}
</section>
2016-05-23 17:14:21 +02:00
<section className="card">
2017-04-10 20:12:07 +02:00
<div className="card__title-primary">
2017-05-22 14:29:30 +02:00
<h4>{__("Access")}</h4>
2017-04-10 20:12:07 +02:00
<div className="card__subtitle">
2017-05-22 14:29:30 +02:00
{__("How much does this content cost?")}
2017-04-10 20:12:07 +02:00
</div>
</div>
2017-04-10 14:32:40 +02:00
<div className="card__content">
2017-04-10 20:12:07 +02:00
<div className="form-row__label-row">
2017-05-22 14:29:30 +02:00
<label className="form-row__label">{__("Price")}</label>
</div>
2017-06-06 23:19:12 +02:00
<FormRow
label={__("Free")}
type="radio"
name="isFree"
value="1"
onChange={() => {
this.handleFeePrefChange(false);
}}
defaultChecked={!this.state.isFee}
/>
<FormField
type="radio"
name="isFree"
label={!this.state.isFee ? __("Choose price...") : __("Price ")}
onChange={() => {
this.handleFeePrefChange(true);
}}
defaultChecked={this.state.isFee}
/>
<span className={!this.state.isFee ? "hidden" : ""}>
<FormField
type="number"
className="form-field__input--inline"
step="0.01"
placeholder="1.00"
2017-06-09 01:25:42 +02:00
min="0.01"
2017-06-06 23:19:12 +02:00
onChange={event => this.handleFeeAmountChange(event)}
/>
{" "}
<FormField
type="select"
onChange={event => {
this.handleFeeCurrencyChange(event);
}}
>
<option value="USD">{__("US Dollars")}</option>
<option value="LBC">{__("LBRY credits")}</option>
</FormField>
</span>
{this.state.isFee
? <div className="form-field__helper">
{__(
"If you choose to price this content in dollars, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase."
)}
</div>
: ""}
<FormRow
label="License"
type="select"
ref="meta_license"
name="license"
onChange={event => {
this.handleLicenseChange(event);
}}
>
<option />
2017-05-22 14:29:30 +02:00
<option>{__("Public Domain")}</option>
2017-06-06 23:19:12 +02:00
<option data-url="https://creativecommons.org/licenses/by/4.0/legalcode">
{__("Creative Commons Attribution 4.0 International")}
</option>
<option data-url="https://creativecommons.org/licenses/by-sa/4.0/legalcode">
{__(
"Creative Commons Attribution-ShareAlike 4.0 International"
)}
</option>
<option data-url="https://creativecommons.org/licenses/by-nd/4.0/legalcode">
{__(
"Creative Commons Attribution-NoDerivatives 4.0 International"
)}
</option>
<option data-url="https://creativecommons.org/licenses/by-nc/4.0/legalcode">
{__(
"Creative Commons Attribution-NonCommercial 4.0 International"
)}
</option>
<option data-url="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode">
{__(
"Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"
)}
</option>
<option data-url="https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode">
{__(
"Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International"
)}
</option>
<option
data-license-type="copyright"
{...(this.state.copyrightChosen
? { value: this.state.copyrightNotice }
: {})}
>
{__("Copyrighted...")}
</option>
<option
data-license-type="other"
{...(this.state.otherLicenseChosen
? { value: this.state.otherLicenseDescription }
: {})}
>
{__("Other...")}
</option>
2017-04-10 20:12:07 +02:00
</FormRow>
2017-06-06 23:19:12 +02:00
<FormField
type="hidden"
ref="meta_license_url"
name="license_url"
value={this.getLicenseUrl()}
/>
2017-04-10 20:12:07 +02:00
{this.state.copyrightChosen
2017-06-06 23:19:12 +02:00
? <FormRow
label={__("Copyright notice")}
type="text"
name="copyright-notice"
value={this.state.copyrightNotice}
onChange={event => {
this.handleCopyrightNoticeChange(event);
}}
/>
2017-04-10 20:12:07 +02:00
: null}
2017-06-06 23:19:12 +02:00
{this.state.otherLicenseChosen
? <FormRow
label={__("License description")}
type="text"
name="other-license-description"
onChange={event => {
this.handleOtherLicenseDescriptionChange();
}}
/>
2017-04-10 20:12:07 +02:00
: null}
2017-06-06 23:19:12 +02:00
{this.state.otherLicenseChosen
? <FormRow
label={__("License URL")}
type="text"
name="other-license-url"
onChange={event => {
this.handleOtherLicenseUrlChange(event);
}}
/>
2017-04-10 20:12:07 +02:00
: null}
2016-08-08 05:31:21 +02:00
</div>
</section>
<section className="card">
2017-04-10 20:12:07 +02:00
<div className="card__title-primary">
2017-05-22 14:29:30 +02:00
<h4>{__("Identity")}</h4>
2017-04-10 20:12:07 +02:00
<div className="card__subtitle">
2017-05-22 14:29:30 +02:00
{__("Who created this content?")}
</div>
2016-08-08 05:31:21 +02:00
</div>
2017-04-10 20:12:07 +02:00
<div className="card__content">
2017-06-06 23:19:12 +02:00
<FormRow
type="select"
tabIndex="1"
onChange={event => {
this.handleChannelChange(event);
}}
value={this.state.channel}
>
<option key="anonymous" value="anonymous">
{__("Anonymous")}
</option>
{this.state.channels.map(({ name }) =>
<option key={name} value={name}>{name}</option>
)}
2017-05-22 14:29:30 +02:00
<option key="new" value="new">{__("New identity...")}</option>
2017-04-10 20:12:07 +02:00
</FormRow>
</div>
2017-06-06 23:19:12 +02:00
{this.state.channel == "new"
? <div className="card__content">
<FormRow
label={__("Name")}
type="text"
onChange={event => {
this.handleNewChannelNameChange(event);
}}
ref={newChannelName => {
this.refs.newChannelName = newChannelName;
}}
value={this.state.newChannelName}
/>
<FormRow
label={__("Deposit")}
postfix="LBC"
step="0.01"
2017-06-09 01:25:42 +02:00
min="0"
2017-06-06 23:19:12 +02:00
type="number"
helper={lbcInputHelp}
onChange={event => {
this.handleNewChannelBidChange(event);
}}
value={this.state.newChannelBid}
/>
<div className="form-row-submit">
<Link
button="primary"
label={
!this.state.creatingChannel
? __("Create identity")
: __("Creating identity...")
}
onClick={event => {
this.handleCreateChannelClick(event);
}}
disabled={this.state.creatingChannel}
/>
</div>
</div>
: null}
</section>
<section className="card">
2017-04-10 20:12:07 +02:00
<div className="card__title-primary">
2017-05-22 14:29:30 +02:00
<h4>{__("Address")}</h4>
2017-06-06 23:19:12 +02:00
<div className="card__subtitle">
{__("Where should this content permanently reside?")}
{" "}
<Link
label={__("Read more")}
href="https://lbry.io/faq/naming"
/>.
</div>
2017-04-10 20:12:07 +02:00
</div>
<div className="card__content">
2017-06-06 23:19:12 +02:00
<FormRow
prefix="lbry://"
type="text"
ref="name"
placeholder="myname"
value={this.state.rawName}
onChange={event => {
this.handleNameChange(event);
}}
helper={this.getNameBidHelpText()}
/>
</div>
2017-06-06 23:19:12 +02:00
{this.state.rawName
? <div className="card__content">
<FormRow
ref="bid"
type="number"
step="0.01"
label={__("Deposit")}
postfix="LBC"
onChange={event => {
this.handleBidChange(event);
}}
value={this.state.bid}
placeholder={
this.state.nameResolved
? this.state.topClaimValue + 10
: 100
}
helper={lbcInputHelp}
/>
</div>
: ""}
</section>
2016-05-23 17:14:21 +02:00
<section className="card">
<div className="card__title-primary">
2017-05-22 14:29:30 +02:00
<h4>{__("Terms of Service")}</h4>
</div>
<div className="card__content">
2017-06-06 23:19:12 +02:00
<FormRow
label={
<span>
{__("I agree to the")}
{" "}
<Link
href="https://www.lbry.io/termsofservice"
label={__("LBRY terms of service")}
checked={this.state.TOSAgreed}
/>
</span>
}
type="checkbox"
name="tos_agree"
ref={field => {
this.refs.tos_agree = field;
}}
onChange={event => {
this.handleTOSChange(event);
}}
/>
</div>
</section>
<div className="card-series-submit">
2017-06-06 23:19:12 +02:00
<Link
button="primary"
label={
!this.state.submitting ? __("Publish") : __("Publishing...")
}
onClick={event => {
this.handleSubmit(event);
}}
disabled={this.state.submitting}
/>
<Link
button="cancel"
onClick={this.props.back}
label={__("Cancel")}
/>
<input type="submit" className="hidden" />
</div>
</form>
2017-06-06 23:19:12 +02:00
<Modal
isOpen={this.state.modal == "publishStarted"}
contentLabel={__("File published")}
onConfirmed={event => {
this.handlePublishStartedConfirmed(event);
}}
>
<p>
{__("Your file has been published to LBRY at the address")}
{" "}<code>lbry://{this.state.name}</code>!
</p>
<p>
{__(
'The file will take a few minutes to appear for other LBRY users. Until then it will be listed as "pending" under your published files.'
)}
</p>
</Modal>
2017-06-06 23:19:12 +02:00
<Modal
isOpen={this.state.modal == "error"}
contentLabel={__("Error publishing file")}
onConfirmed={event => {
this.closeModal(event);
}}
>
{__(
"The following error occurred when attempting to publish your file"
)}: {this.state.errorMessage}
</Modal>
</main>
2016-05-23 17:14:21 +02:00
);
}
2017-05-17 10:10:25 +02:00
}
2016-11-22 21:19:08 +01:00
export default PublishPage;