initial merge

This commit is contained in:
Intnick 2017-05-22 14:29:30 +02:00
parent d5a4032b9f
commit 59aa56b7ef
2 changed files with 71 additions and 68 deletions

View file

@ -75,4 +75,4 @@
"Discover": "Discover", "Discover": "Discover",
"Fetching content": "Fetching content", "Fetching content": "Fetching content",
"What's this?": "What's this?" "What's this?": "What's this?"
} }

View file

@ -179,7 +179,7 @@ class PublishPage extends React.Component {
} }
if (!lbryuri.isValidName(rawName, false)) { if (!lbryuri.isValidName(rawName, false)) {
this.refs.name.showError('LBRY names must contain only letters, numbers and dashes.'); this.refs.name.showError(__("LBRY names must contain only letters, numbers and dashes."));
return; return;
} }
@ -266,7 +266,7 @@ class PublishPage extends React.Component {
}; };
if (licenseType == 'copyright') { if (licenseType == 'copyright') {
newState.copyrightNotice = 'All rights reserved.' newState.copyrightNotice = __("All rights reserved.")
} }
this.setState(newState); this.setState(newState);
@ -302,7 +302,7 @@ class PublishPage extends React.Component {
const newChannelName = (event.target.value.startsWith('@') ? event.target.value : '@' + event.target.value); const newChannelName = (event.target.value.startsWith('@') ? event.target.value : '@' + event.target.value);
if (newChannelName.length > 1 && !lbryuri.isValidName(newChannelName.substr(1), false)) { if (newChannelName.length > 1 && !lbryuri.isValidName(newChannelName.substr(1), false)) {
this.refs.newChannelName.showError('LBRY channel names must contain only letters, numbers and dashes.'); this.refs.newChannelName.showError(__("LBRY channel names must contain only letters, numbers and dashes."));
return; return;
} else { } else {
this.refs.newChannelName.clearError() this.refs.newChannelName.clearError()
@ -327,7 +327,7 @@ class PublishPage extends React.Component {
handleCreateChannelClick(event) { handleCreateChannelClick(event) {
if (this.state.newChannelName.length < 5) { if (this.state.newChannelName.length < 5) {
this.refs.newChannelName.showError('LBRY channel names must be at least 4 characters in length.'); this.refs.newChannelName.showError(__("LBRY channel names must be at least 4 characters in length."));
return; return;
} }
@ -346,7 +346,7 @@ class PublishPage extends React.Component {
}, 5000); }, 5000);
}, (error) => { }, (error) => {
// TODO: better error handling // TODO: better error handling
this.refs.newChannelName.showError('Unable to create channel due to an internal error.'); this.refs.newChannelName.showError(__("Unable to create channel due to an internal error."));
this.setState({ this.setState({
creatingChannel: false, creatingChannel: false,
}); });
@ -377,14 +377,17 @@ class PublishPage extends React.Component {
getNameBidHelpText() { getNameBidHelpText() {
if (!this.state.name) { if (!this.state.name) {
return "Select a URL for this publish."; return __("Select a URL for this publish.");
} else if (this.state.nameResolved === false) { } else if (this.state.nameResolved === false) {
return "This URL is unused."; return __("This URL is unused.");
} else if (this.state.myClaimExists) { } else if (this.state.myClaimExists) {
return "You have already used this URL. Publishing to it again will update your previous publish." return __("You have already used this URL. Publishing to it again will update your previous publish.")
} else if (this.state.topClaimValue) { } else if (this.state.topClaimValue) {
return <span>A deposit of at least <strong>{this.state.topClaimValue}</strong> {this.state.topClaimValue == 1 ? 'credit ' : 'credits '} 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."
is required to win <strong>{this.state.name}</strong>. However, you can still get a permanent URL for any amount.</span> , "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>
} else { } else {
return ''; return '';
} }
@ -401,49 +404,49 @@ class PublishPage extends React.Component {
return null; return null;
} }
const lbcInputHelp = "This LBC remains yours and the deposit can be undone at any time." const lbcInputHelp = __("This LBC remains yours and the deposit can be undone at any time.");
return ( return (
<main className="main--single-column"> <main className="main--single-column">
<form onSubmit={(event) => { this.handleSubmit(event) }}> <form onSubmit={(event) => { this.handleSubmit(event) }}>
<section className="card"> <section className="card">
<div className="card__title-primary"> <div className="card__title-primary">
<h4>Content</h4> <h4>{__("Content")}</h4>
<div className="card__subtitle"> <div className="card__subtitle">
What are you publishing? {__("What are you publishing?")}
</div> </div>
</div> </div>
<div className="card__content"> <div className="card__content">
<FormRow name="file" label="File" ref="file" type="file" onChange={(event) => { this.onFileChange(event) }} <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}/> helper={this.state.myClaimExists ? __("If you don't choose a file, the file from your existing claim will be used.") : null}/>
</div> </div>
{ !this.state.hasFile ? '' : { !this.state.hasFile ? '' :
<div> <div>
<div className="card__content"> <div className="card__content">
<FormRow label="Title" type="text" ref="meta_title" name="title" placeholder="Titular Title" /> <FormRow label={__("Title")} type="text" ref="meta_title" name="title" placeholder={__("Title")} />
</div> </div>
<div className="card__content"> <div className="card__content">
<FormRow type="text" label="Thumbnail URL" ref="meta_thumbnail" name="thumbnail" placeholder="http://spee.ch/mylogo" /> <FormRow type="text" label={__("Thumbnail URL")} ref="meta_thumbnail" name="thumbnail" placeholder="http://spee.ch/mylogo" />
</div> </div>
<div className="card__content"> <div className="card__content">
<FormRow label="Description" type="textarea" ref="meta_description" name="description" placeholder="Description of your content" /> <FormRow label={__("Description")} type="textarea" ref="meta_description" name="description" placeholder={__("Description of your content")} />
</div> </div>
<div className="card__content"> <div className="card__content">
<FormRow label="Language" type="select" defaultValue="en" ref="meta_language" name="language"> <FormRow label={__("Language")} type="select" defaultValue="en" ref="meta_language" name="language">
<option value="en">English</option> <option value="en">{__("English")}</option>
<option value="zh">Chinese</option> <option value="zh">{__("Chinese")}</option>
<option value="fr">French</option> <option value="fr">{__("French")}</option>
<option value="de">German</option> <option value="de">{__("German")}</option>
<option value="jp">Japanese</option> <option value="jp">{__("Japanese")}</option>
<option value="ru">Russian</option> <option value="ru">{__("Russian")}</option>
<option value="es">Spanish</option> <option value="es">{__("Spanish")}</option>
</FormRow> </FormRow>
</div> </div>
<div className="card__content"> <div className="card__content">
<FormRow type="select" label="Maturity" defaultValue="en" ref="meta_nsfw" name="nsfw"> <FormRow type="select" label={__("Maturity")} defaultValue="en" ref="meta_nsfw" name="nsfw">
{/* <option value=""></option> */} {/* <option value=""></option> */}
<option value="0">All Ages</option> <option value="0">{__("All Ages")}</option>
<option value="1">Adults Only</option> <option value="1">{__("Adults Only")}</option>
</FormRow> </FormRow>
</div> </div>
</div>} </div>}
@ -451,73 +454,73 @@ class PublishPage extends React.Component {
<section className="card"> <section className="card">
<div className="card__title-primary"> <div className="card__title-primary">
<h4>Access</h4> <h4>{__("Access")}</h4>
<div className="card__subtitle"> <div className="card__subtitle">
How much does this content cost? {__("How much does this content cost?")}
</div> </div>
</div> </div>
<div className="card__content"> <div className="card__content">
<div className="form-row__label-row"> <div className="form-row__label-row">
<label className="form-row__label">Price</label> <label className="form-row__label">{__("Price")}</label>
</div> </div>
<FormRow label="Free" type="radio" name="isFree" value="1" onChange={ () => { this.handleFeePrefChange(false) } } defaultChecked={!this.state.isFee} /> <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 ' } <FormField type="radio" name="isFree" label={!this.state.isFee ? __('Choose price...') : __('Price ') }
onChange={ () => { this.handleFeePrefChange(true) } } defaultChecked={this.state.isFee} /> onChange={ () => { this.handleFeePrefChange(true) } } defaultChecked={this.state.isFee} />
<span className={!this.state.isFee ? 'hidden' : ''}> <span className={!this.state.isFee ? 'hidden' : ''}>
<FormField type="number" className="form-field__input--inline" step="0.01" placeholder="1.00" onChange={(event) => this.handleFeeAmountChange(event)} /> <FormField type="select" onChange={(event) => { this.handleFeeCurrencyChange(event) }}> <FormField type="number" className="form-field__input--inline" step="0.01" placeholder="1.00" onChange={(event) => this.handleFeeAmountChange(event)} /> <FormField type="select" onChange={(event) => { this.handleFeeCurrencyChange(event) }}>
<option value="USD">US Dollars</option> <option value="USD">{__("US Dollars")}</option>
<option value="LBC">LBRY credits</option> <option value="LBC">{__("LBRY credits")}</option>
</FormField> </FormField>
</span> </span>
{ this.state.isFee ? { this.state.isFee ?
<div className="form-field__helper"> <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. {__("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> : '' } </div> : '' }
<FormRow label="License" type="select" ref="meta_license" name="license" onChange={(event) => { this.handleLicenseChange(event) }}> <FormRow label="License" type="select" ref="meta_license" name="license" onChange={(event) => { this.handleLicenseChange(event) }}>
<option></option> <option></option>
<option>Public Domain</option> <option>{__("Public Domain")}</option>
<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/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-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-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/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-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-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="copyright" {... this.state.copyrightChosen ? {value: this.state.copyrightNotice} : {}}>{__("Copyrighted...")}</option>
<option data-license-type="other" {... this.state.otherLicenseChosen ? {value: this.state.otherLicenseDescription} : {}}>Other...</option> <option data-license-type="other" {... this.state.otherLicenseChosen ? {value: this.state.otherLicenseDescription} : {}}>{__("Other...")}</option>
</FormRow> </FormRow>
<FormField type="hidden" ref="meta_license_url" name="license_url" value={this.getLicenseUrl()} /> <FormField type="hidden" ref="meta_license_url" name="license_url" value={this.getLicenseUrl()} />
{this.state.copyrightChosen {this.state.copyrightChosen
? <FormRow label="Copyright notice" type="text" name="copyright-notice" ? <FormRow label={__("Copyright notice")} type="text" name="copyright-notice"
value={this.state.copyrightNotice} onChange={(event) => { this.handleCopyrightNoticeChange(event) }} /> value={this.state.copyrightNotice} onChange={(event) => { this.handleCopyrightNoticeChange(event) }} />
: null} : null}
{this.state.otherLicenseChosen ? {this.state.otherLicenseChosen ?
<FormRow label="License description" type="text" name="other-license-description" onChange={(event) => { this.handleOtherLicenseDescriptionChange() }} /> <FormRow label={__("License description")} type="text" name="other-license-description" onChange={(event) => { this.handleOtherLicenseDescriptionChange() }} />
: null} : null}
{this.state.otherLicenseChosen ? {this.state.otherLicenseChosen ?
<FormRow label="License URL" type="text" name="other-license-url" onChange={(event) => { this.handleOtherLicenseUrlChange(event) }} /> <FormRow label={__("License URL")} type="text" name="other-license-url" onChange={(event) => { this.handleOtherLicenseUrlChange(event) }} />
: null} : null}
</div> </div>
</section> </section>
<section className="card"> <section className="card">
<div className="card__title-primary"> <div className="card__title-primary">
<h4>Identity</h4> <h4>{__("Identity")}</h4>
<div className="card__subtitle"> <div className="card__subtitle">
Who created this content? {__("Who created this content?")}
</div> </div>
</div> </div>
<div className="card__content"> <div className="card__content">
<FormRow type="select" tabIndex="1" onChange={(event) => { this.handleChannelChange(event) }} value={this.state.channel}> <FormRow type="select" tabIndex="1" onChange={(event) => { this.handleChannelChange(event) }} value={this.state.channel}>
<option key="anonymous" value="anonymous">Anonymous</option> <option key="anonymous" value="anonymous">{__("Anonymous")}</option>
{this.state.channels.map(({name}) => <option key={name} value={name}>{name}</option>)} {this.state.channels.map(({name}) => <option key={name} value={name}>{name}</option>)}
<option key="new" value="new">New identity...</option> <option key="new" value="new">{__("New identity...")}</option>
</FormRow> </FormRow>
</div> </div>
{this.state.channel == 'new' ? {this.state.channel == 'new' ?
<div className="card__content"> <div className="card__content">
<FormRow label="Name" type="text" onChange={(event) => { this.handleNewChannelNameChange(event) }} ref={newChannelName => { this.refs.newChannelName = newChannelName }} <FormRow label={__("Name")} type="text" onChange={(event) => { this.handleNewChannelNameChange(event) }} ref={newChannelName => { this.refs.newChannelName = newChannelName }}
value={this.state.newChannelName} /> value={this.state.newChannelName} />
<FormRow label="Deposit" <FormRow label={__("Deposit")}
postfix="LBC" postfix="LBC"
step="0.01" step="0.01"
type="number" type="number"
@ -525,7 +528,7 @@ class PublishPage extends React.Component {
onChange={(event) => { this.handleNewChannelBidChange(event) }} onChange={(event) => { this.handleNewChannelBidChange(event) }}
value={this.state.newChannelBid} /> value={this.state.newChannelBid} />
<div className="form-row-submit"> <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} /> <Link button="primary" label={!this.state.creatingChannel ? __("Create identity") : __("Creating identity...")} onClick={(event) => { this.handleCreateChannelClick(event) }} disabled={this.state.creatingChannel} />
</div> </div>
</div> </div>
: null} : null}
@ -534,8 +537,8 @@ class PublishPage extends React.Component {
<section className="card"> <section className="card">
<div className="card__title-primary"> <div className="card__title-primary">
<h4>Address</h4> <h4>{__("Address")}</h4>
<div className="card__subtitle">Where should this content permanently reside? <Link label="Read more" href="https://lbry.io/faq/naming" />.</div> <div className="card__subtitle">{__("Where should this content permanently reside?")} <Link label={__("Read more")} href="https://lbry.io/faq/naming" />.</div>
</div> </div>
<div className="card__content"> <div className="card__content">
<FormRow prefix="lbry://" type="text" ref="name" placeholder="myname" value={this.state.rawName} onChange={(event) => { this.handleNameChange(event) }} <FormRow prefix="lbry://" type="text" ref="name" placeholder="myname" value={this.state.rawName} onChange={(event) => { this.handleNameChange(event) }}
@ -546,7 +549,7 @@ class PublishPage extends React.Component {
<FormRow ref="bid" <FormRow ref="bid"
type="number" type="number"
step="0.01" step="0.01"
label="Deposit" label={__("Deposit")}
postfix="LBC" postfix="LBC"
onChange={(event) => { this.handleBidChange(event) }} onChange={(event) => { this.handleBidChange(event) }}
value={this.state.bid} value={this.state.bid}
@ -557,30 +560,30 @@ class PublishPage extends React.Component {
<section className="card"> <section className="card">
<div className="card__title-primary"> <div className="card__title-primary">
<h4>Terms of Service</h4> <h4>{__("Terms of Service")}</h4>
</div> </div>
<div className="card__content"> <div className="card__content">
<FormRow label={ <FormRow label={
<span>I agree to the <Link href="https://www.lbry.io/termsofservice" label="LBRY terms of service" checked={this.state.TOSAgreed} /></span> <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)}} /> } type="checkbox" name="tos_agree" ref={(field) => { this.refs.tos_agree = field }} onChange={(event) => { this.handleTOSChange(event)}} />
</div> </div>
</section> </section>
<div className="card-series-submit"> <div className="card-series-submit">
<Link button="primary" label={!this.state.submitting ? 'Publish' : 'Publishing...'} onClick={(event) => { this.handleSubmit(event) }} disabled={this.state.submitting} /> <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" /> <Link button="cancel" onClick={this.props.back} label={__("Cancel")} />
<input type="submit" className="hidden" /> <input type="submit" className="hidden" />
</div> </div>
</form> </form>
<Modal isOpen={this.state.modal == 'publishStarted'} contentLabel="File published" <Modal isOpen={this.state.modal == 'publishStarted'} contentLabel={__("File published")}
onConfirmed={(event) => { this.handlePublishStartedConfirmed(event) }}> onConfirmed={(event) => { this.handlePublishStartedConfirmed(event) }}>
<p>Your file has been published to LBRY at the address <code>lbry://{this.state.name}</code>!</p> <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> <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> </Modal>
<Modal isOpen={this.state.modal == 'error'} contentLabel="Error publishing file" <Modal isOpen={this.state.modal == 'error'} contentLabel={__("Error publishing file")}
onConfirmed={(event) => { this.closeModal(event) }}> onConfirmed={(event) => { this.closeModal(event) }}>
The following error occurred when attempting to publish your file: {this.state.errorMessage} {__("The following error occurred when attempting to publish your file")}: {this.state.errorMessage}
</Modal> </Modal>
</main> </main>
); );