2018-03-26 23:32:43 +02:00
// @flow
2018-11-26 02:21:25 +01:00
import type { Claim } from 'types/claim' ;
import type { PublishParams , UpdatePublishFormData } from 'redux/reducers/publish' ;
import { COPYRIGHT , OTHER } from 'constants/licenses' ;
import { CHANNEL _NEW , CHANNEL _ANONYMOUS , MINIMUM _PUBLISH _BID } from 'constants/claim' ;
import * as ICONS from 'constants/icons' ;
2018-03-26 23:32:43 +02:00
import * as React from 'react' ;
2018-06-14 23:31:27 +02:00
import { isNameValid , buildURI , regexInvalidURI , THUMBNAIL _STATUSES } from 'lbry-redux' ;
2018-03-26 23:32:43 +02:00
import { Form , FormField , FormRow , FormFieldPrice , Submit } from 'component/common/form' ;
import Button from 'component/button' ;
import ChannelSection from 'component/selectChannel' ;
import classnames from 'classnames' ;
import FileSelector from 'component/common/file-selector' ;
2018-04-02 18:39:00 +02:00
import SelectThumbnail from 'component/selectThumbnail' ;
2018-03-30 07:37:09 +02:00
import BidHelpText from './internal/bid-help-text' ;
2018-09-25 02:17:08 +02:00
import NameHelpText from './internal/name-help-text' ;
2018-03-30 07:37:09 +02:00
import LicenseType from './internal/license-type' ;
2018-03-26 23:32:43 +02:00
type Props = {
publish : PublishParams => void ,
filePath : ? string ,
bid : ? number ,
editingURI : ? string ,
title : ? string ,
thumbnail : ? string ,
2018-04-02 15:53:29 +02:00
uploadThumbnailStatus : ? string ,
2018-06-08 06:05:45 +02:00
thumbnailPath : ? string ,
2018-03-26 23:32:43 +02:00
description : ? string ,
language : string ,
nsfw : boolean ,
contentIsFree : boolean ,
price : {
amount : number ,
currency : string ,
} ,
channel : string ,
name : ? string ,
updatePublishForm : UpdatePublishFormData => void ,
nameError : ? string ,
isResolvingUri : boolean ,
winningBidForClaimUri : number ,
2018-05-25 20:05:30 +02:00
myClaimForUri : ? Claim ,
2018-03-26 23:32:43 +02:00
licenseType : string ,
otherLicenseDescription : ? string ,
licenseUrl : ? string ,
uri : ? string ,
bidError : ? string ,
publishing : boolean ,
balance : number ,
2018-06-12 07:11:17 +02:00
isStillEditing : boolean ,
2018-03-26 23:32:43 +02:00
clearPublish : ( ) => void ,
resolveUri : string => void ,
scrollToTop : ( ) => void ,
2018-10-13 17:49:47 +02:00
prepareEdit : ( claim : any , uri : string ) => void ,
2018-04-02 15:53:29 +02:00
resetThumbnailStatus : ( ) => void ,
2018-09-25 02:17:08 +02:00
amountNeededForTakeover : ? number ,
2018-03-26 23:32:43 +02:00
} ;
class PublishForm extends React . PureComponent < Props > {
constructor ( props : Props ) {
2017-06-30 10:45:54 +02:00
super ( props ) ;
2018-03-26 23:32:43 +02:00
( this : any ) . handleFileChange = this . handleFileChange . bind ( this ) ;
( this : any ) . checkIsFormValid = this . checkIsFormValid . bind ( this ) ;
( this : any ) . renderFormErrors = this . renderFormErrors . bind ( this ) ;
( this : any ) . handlePublish = this . handlePublish . bind ( this ) ;
( this : any ) . handleCancelPublish = this . handleCancelPublish . bind ( this ) ;
( this : any ) . handleNameChange = this . handleNameChange . bind ( this ) ;
( this : any ) . handleChannelChange = this . handleChannelChange . bind ( this ) ;
( this : any ) . editExistingClaim = this . editExistingClaim . bind ( this ) ;
( this : any ) . getNewUri = this . getNewUri . bind ( this ) ;
}
2018-04-02 15:53:29 +02:00
componentWillMount ( ) {
2018-07-18 17:46:21 +02:00
const { thumbnail } = this . props ;
2018-07-17 19:43:43 +02:00
if ( ! thumbnail ) {
2018-06-13 06:19:39 +02:00
this . props . resetThumbnailStatus ( ) ;
}
2018-04-02 15:53:29 +02:00
}
2018-04-04 01:17:40 +02:00
getNewUri ( name : string , channel : string ) {
const { resolveUri } = this . props ;
// If they are midway through a channel creation, treat it as anonymous until it completes
const channelName = channel === CHANNEL _ANONYMOUS || channel === CHANNEL _NEW ? '' : channel ;
2018-03-26 23:32:43 +02:00
2018-09-25 02:17:08 +02:00
// We are only going to store the full uri, but we need to resolve the uri with and without the channel name
2018-04-04 01:17:40 +02:00
let uri ;
try {
uri = buildURI ( { contentName : name , channelName } ) ;
} catch ( e ) {
// something wrong with channel or name
2017-06-30 10:45:54 +02:00
}
2018-04-04 01:17:40 +02:00
if ( uri ) {
2018-09-25 02:17:08 +02:00
if ( channelName ) {
// resolve without the channel name so we know the winning bid for it
const uriLessChannel = buildURI ( { contentName : name } ) ;
resolveUri ( uriLessChannel ) ;
}
2018-04-04 01:17:40 +02:00
resolveUri ( uri ) ;
return uri ;
2017-08-26 04:09:56 +02:00
}
2018-04-04 01:17:40 +02:00
return '' ;
2017-08-26 04:09:56 +02:00
}
2018-03-26 23:32:43 +02:00
handleFileChange ( filePath : string , fileName : string ) {
2018-04-03 06:05:11 +02:00
const { updatePublishForm , channel , name } = this . props ;
2018-10-13 17:49:47 +02:00
const newFileParams : UpdatePublishFormData = { filePath } ;
2017-06-30 10:45:54 +02:00
2018-04-03 06:05:11 +02:00
if ( ! name ) {
const parsedFileName = fileName . replace ( regexInvalidURI , '' ) ;
const uri = this . getNewUri ( parsedFileName , channel ) ;
newFileParams . name = parsedFileName ;
2018-04-04 01:17:40 +02:00
newFileParams . uri = uri ;
2018-03-26 23:32:43 +02:00
}
2018-04-03 06:05:11 +02:00
updatePublishForm ( newFileParams ) ;
2017-06-30 10:45:54 +02:00
}
2018-03-26 23:32:43 +02:00
handleNameChange ( name : ? string ) {
const { channel , updatePublishForm } = this . props ;
2017-06-30 10:45:54 +02:00
2018-03-26 23:32:43 +02:00
if ( ! name ) {
2018-10-26 06:20:18 +02:00
updatePublishForm ( { name : '' , nameError : _ _ ( 'A name is required.' ) } ) ;
2017-06-30 10:45:54 +02:00
return ;
}
2018-03-26 23:32:43 +02:00
if ( ! isNameValid ( name , false ) ) {
updatePublishForm ( {
name ,
nameError : _ _ ( 'LBRY names must contain only letters, numbers and dashes.' ) ,
} ) ;
2017-06-30 10:45:54 +02:00
return ;
}
2018-03-26 23:32:43 +02:00
const uri = this . getNewUri ( name , channel ) ;
updatePublishForm ( {
2017-12-21 22:08:54 +01:00
name ,
2017-06-30 10:45:54 +02:00
uri ,
2018-03-26 23:32:43 +02:00
nameError : undefined ,
2017-06-30 10:45:54 +02:00
} ) ;
}
2018-03-26 23:32:43 +02:00
handleChannelChange ( channelName : string ) {
2018-05-25 20:05:30 +02:00
const { name , updatePublishForm } = this . props ;
2018-10-13 17:49:47 +02:00
const form : UpdatePublishFormData = { channel : channelName } ;
2018-05-25 20:05:30 +02:00
2018-03-26 23:32:43 +02:00
if ( name ) {
2018-05-16 01:01:53 +02:00
form . uri = this . getNewUri ( name , channelName ) ;
2017-06-30 10:45:54 +02:00
}
2018-05-16 01:01:53 +02:00
updatePublishForm ( form ) ;
2017-06-30 10:45:54 +02:00
}
2018-03-26 23:32:43 +02:00
handleBidChange ( bid : number ) {
2018-07-02 20:48:25 +02:00
const { balance , updatePublishForm , myClaimForUri } = this . props ;
let previousBidAmount = 0 ;
if ( myClaimForUri ) {
previousBidAmount = myClaimForUri . amount ;
}
const totalAvailableBidAmount = previousBidAmount + balance ;
2017-06-30 10:45:54 +02:00
2018-03-26 23:32:43 +02:00
let bidError ;
2018-06-18 08:34:59 +02:00
if ( bid === 0 ) {
bidError = _ _ ( 'Deposit cannot be 0' ) ;
2018-07-02 20:48:25 +02:00
} else if ( totalAvailableBidAmount === bid ) {
2018-06-18 08:34:59 +02:00
bidError = _ _ ( 'Please decrease your deposit to account for transaction fees' ) ;
2018-07-02 20:48:25 +02:00
} else if ( totalAvailableBidAmount < bid ) {
2018-06-18 08:34:59 +02:00
bidError = _ _ ( 'Deposit cannot be higher than your balance' ) ;
2018-03-26 23:32:43 +02:00
} else if ( bid <= MINIMUM _PUBLISH _BID ) {
2018-06-18 08:34:59 +02:00
bidError = _ _ ( 'Your deposit must be higher' ) ;
2018-03-26 23:32:43 +02:00
}
2017-06-30 10:45:54 +02:00
2018-03-26 23:32:43 +02:00
updatePublishForm ( { bid , bidError } ) ;
2017-06-30 10:45:54 +02:00
}
2018-04-06 08:22:35 +02:00
editExistingClaim ( myClaimForUri : ? { } , uri : string ) {
const { prepareEdit , scrollToTop } = this . props ;
2018-04-04 01:17:40 +02:00
if ( myClaimForUri ) {
2018-04-06 08:22:35 +02:00
prepareEdit ( myClaimForUri , uri ) ;
2018-04-04 01:17:40 +02:00
scrollToTop ( ) ;
2017-06-30 10:45:54 +02:00
}
2018-04-04 01:17:40 +02:00
}
2017-06-30 10:45:54 +02:00
2018-04-04 01:17:40 +02:00
handleCancelPublish ( ) {
const { clearPublish , scrollToTop } = this . props ;
scrollToTop ( ) ;
clearPublish ( ) ;
}
handlePublish ( ) {
const {
filePath ,
licenseType ,
licenseUrl ,
otherLicenseDescription ,
2018-04-04 01:46:03 +02:00
myClaimForUri ,
2018-06-13 05:28:06 +02:00
publish ,
2018-04-04 01:17:40 +02:00
} = this . props ;
let publishingLicense ;
switch ( licenseType ) {
case COPYRIGHT :
case OTHER :
publishingLicense = otherLicenseDescription ;
break ;
default :
publishingLicense = licenseType ;
2017-06-30 10:45:54 +02:00
}
2018-04-04 01:17:40 +02:00
const publishingLicenseUrl = licenseType === COPYRIGHT ? '' : licenseUrl ;
2018-10-13 17:49:47 +02:00
const publishParams : PublishParams = {
filePath : filePath || undefined ,
bid : this . props . bid || undefined ,
title : this . props . title || '' ,
2018-06-13 05:28:06 +02:00
thumbnail : this . props . thumbnail ,
description : this . props . description ,
language : this . props . language ,
nsfw : this . props . nsfw ,
2018-04-04 01:17:40 +02:00
license : publishingLicense ,
licenseUrl : publishingLicenseUrl ,
otherLicenseDescription ,
2018-10-13 17:49:47 +02:00
name : this . props . name || undefined ,
2018-06-13 05:28:06 +02:00
contentIsFree : this . props . contentIsFree ,
price : this . props . price ,
2018-10-13 17:49:47 +02:00
uri : this . props . uri || undefined ,
2018-06-13 05:28:06 +02:00
channel : this . props . channel ,
isStillEditing : this . props . isStillEditing ,
2018-04-04 01:17:40 +02:00
} ;
2018-04-04 01:46:03 +02:00
// Editing a claim
2018-10-13 17:49:47 +02:00
if ( ! filePath && myClaimForUri && myClaimForUri . value ) {
2018-04-04 01:46:03 +02:00
const { source } = myClaimForUri . value . stream ;
2018-04-04 19:18:52 +02:00
publishParams . sources = source ;
2018-04-04 01:46:03 +02:00
}
2018-04-04 01:17:40 +02:00
publish ( publishParams ) ;
2017-06-30 10:45:54 +02:00
}
2018-03-26 23:32:43 +02:00
checkIsFormValid ( ) {
2018-07-02 18:37:07 +02:00
const {
name ,
nameError ,
title ,
bid ,
bidError ,
editingURI ,
isStillEditing ,
filePath ,
2018-08-10 06:50:26 +02:00
uploadThumbnailStatus ,
2018-07-02 18:37:07 +02:00
} = this . props ;
// If they are editing, they don't need a new file chosen
2018-08-13 21:57:23 +02:00
const formValidLessFile =
name &&
! nameError &&
title &&
bid &&
! bidError &&
! ( uploadThumbnailStatus === THUMBNAIL _STATUSES . IN _PROGRESS ) ;
2018-07-02 18:37:07 +02:00
return editingURI && ! filePath ? isStillEditing && formValidLessFile : formValidLessFile ;
2017-07-22 11:10:37 +02:00
}
2018-03-26 23:32:43 +02:00
renderFormErrors ( ) {
2018-07-02 18:37:07 +02:00
const {
name ,
nameError ,
title ,
bid ,
bidError ,
editingURI ,
filePath ,
isStillEditing ,
2018-08-10 06:50:26 +02:00
uploadThumbnailStatus ,
2018-07-02 18:37:07 +02:00
} = this . props ;
const isFormValid = this . checkIsFormValid ( ) ;
2017-06-30 10:45:54 +02:00
2018-06-28 22:12:17 +02:00
// These are extra help
// If there is an error it will be presented as an inline error as well
2018-03-26 23:32:43 +02:00
return (
2018-07-02 18:37:07 +02:00
! isFormValid && (
< div className = "card__content card__subtitle form-field__error" >
{ ! title && < div > { _ _ ( 'A title is required' ) } < / div > }
{ ! name && < div > { _ _ ( 'A URL is required' ) } < / div > }
{ name && nameError && < div > { _ _ ( 'The URL you created is not valid' ) } < / div > }
2018-10-05 17:38:21 +02:00
{ ! bid && < div > { _ _ ( 'A deposit amount is required' ) } < / div > }
2018-07-02 18:37:07 +02:00
{ ! ! bid && bidError && < div > { bidError } < / div > }
2018-09-25 02:17:08 +02:00
{ uploadThumbnailStatus === THUMBNAIL _STATUSES . IN _PROGRESS && (
< div > { _ _ ( 'Please wait for thumbnail to finish uploading' ) } < / div >
) }
2019-01-08 00:29:40 +01:00
{ ! ! editingURI &&
! isStillEditing &&
! filePath && < div > { _ _ ( 'You need to reselect a file after changing the LBRY URL' ) } < / div > }
2018-07-02 18:37:07 +02:00
< / div >
)
2018-03-26 23:32:43 +02:00
) ;
2017-06-30 10:45:54 +02:00
}
render ( ) {
2018-03-26 23:32:43 +02:00
const {
filePath ,
editingURI ,
title ,
thumbnail ,
2018-04-02 15:53:29 +02:00
uploadThumbnailStatus ,
2018-03-26 23:32:43 +02:00
description ,
language ,
nsfw ,
contentIsFree ,
price ,
channel ,
name ,
updatePublishForm ,
bid ,
nameError ,
isResolvingUri ,
winningBidForClaimUri ,
myClaimForUri ,
licenseType ,
otherLicenseDescription ,
licenseUrl ,
uri ,
bidError ,
publishing ,
clearPublish ,
2018-06-08 06:05:45 +02:00
thumbnailPath ,
resetThumbnailStatus ,
2018-06-12 07:11:17 +02:00
isStillEditing ,
2018-09-25 02:17:08 +02:00
amountNeededForTakeover ,
2018-03-26 23:32:43 +02:00
} = this . props ;
const formDisabled = ( ! filePath && ! editingURI ) || publishing ;
const formValid = this . checkIsFormValid ( ) ;
let submitLabel ;
if ( isStillEditing ) {
submitLabel = ! publishing ? _ _ ( 'Edit' ) : _ _ ( 'Editing...' ) ;
} else {
submitLabel = ! publishing ? _ _ ( 'Publish' ) : _ _ ( 'Publishing...' ) ;
2017-09-05 03:03:48 +02:00
}
2018-09-25 02:17:08 +02:00
const shortUri = buildURI ( { contentName : name } ) ;
2017-06-30 10:45:54 +02:00
return (
2018-03-26 23:32:43 +02:00
< Form onSubmit = { this . handlePublish } >
2018-06-28 22:13:59 +02:00
< section className = { classnames ( 'card card--section' , { 'card--disabled' : publishing } ) } >
2018-12-19 06:44:53 +01:00
< header className = "card__header" >
< h2 className = "card__title" > { _ _ ( 'Content' ) } < / h2 >
< p className = "card__subtitle" >
2019-01-08 00:29:40 +01:00
{ isStillEditing
? _ _ ( 'You are currently editing a claim.' )
: _ _ ( 'What are you publishing?' ) } { ' ' }
2018-12-19 06:44:53 +01:00
{ _ _ ( 'Read our' ) } { ' ' }
< Button button = "link" label = { _ _ ( 'FAQ' ) } href = "https://lbry.io/faq/how-to-publish" / > { ' ' }
{ _ _ ( 'to learn more.' ) }
< / p >
< / header >
{ ( filePath || ! ! editingURI ) && (
< div className = "card__internal-links" >
< Button
button = "inverse"
icon = { ICONS . CLOSE }
label = { _ _ ( 'Clear' ) }
onClick = { clearPublish }
/ >
< / div >
) }
2018-07-18 17:46:21 +02:00
< div className = "card__content" >
< FileSelector currentPath = { filePath } onFileChosen = { this . handleFileChange } / >
2019-01-08 00:29:40 +01:00
{ ! ! isStillEditing &&
name && (
< p className = "help" >
{ _ _ ( "If you don't choose a file, the file from your existing claim" ) }
{ ` " ${ name } " ` }
{ _ _ ( 'will be used.' ) }
< / p >
) }
2018-07-18 17:46:21 +02:00
< / div >
2018-03-26 23:32:43 +02:00
< / section >
< div className = { classnames ( { 'card--disabled' : formDisabled } ) } >
< section className = "card card--section" >
< FormRow >
< FormField
stretch
type = "text"
name = "content_title"
label = { _ _ ( 'Title' ) }
placeholder = { _ _ ( 'Titular Title' ) }
disabled = { formDisabled }
value = { title }
onChange = { e => updatePublishForm ( { title : e . target . value } ) }
/ >
< / FormRow >
< FormRow padded >
< FormField
stretch
type = "markdown"
name = "content_description"
label = { _ _ ( 'Description' ) }
placeholder = { _ _ ( 'Description of your content' ) }
value = { description }
disabled = { formDisabled }
onChange = { text => updatePublishForm ( { description : text } ) }
/ >
< / FormRow >
2017-06-30 10:45:54 +02:00
< / section >
2018-06-08 06:05:45 +02:00
< section className = "card card--section" >
2018-12-19 06:44:53 +01:00
< header className = "card__header" >
< h2 className = "card__title" > { _ _ ( 'Thumbnail' ) } < / h2 >
< p className = "card__subtitle" >
{ uploadThumbnailStatus === THUMBNAIL _STATUSES . API _DOWN ? (
_ _ ( 'Enter a URL for your thumbnail.' )
) : (
< React.Fragment >
{ _ _ ( 'Upload your thumbnail (.png/.jpg/.jpeg/.gif) to' ) } { ' ' }
< Button button = "link" label = { _ _ ( 'spee.ch' ) } href = "https://spee.ch/about" / > . { ' ' }
{ _ _ ( 'Recommended size: 800x450 (16:9)' ) }
< / React.Fragment >
) }
< / p >
< / header >
2018-06-08 06:05:45 +02:00
< SelectThumbnail
thumbnailPath = { thumbnailPath }
thumbnail = { thumbnail }
uploadThumbnailStatus = { uploadThumbnailStatus }
updatePublishForm = { updatePublishForm }
formDisabled = { formDisabled }
resetThumbnailStatus = { resetThumbnailStatus }
/ >
< / section >
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2018-12-19 06:44:53 +01:00
< header className = "card__header" >
< h2 className = "card__title" > { _ _ ( 'Price' ) } < / h2 >
< p className = "card__subtitle" > { _ _ ( 'How much will this content cost?' ) } < / p >
< / header >
2017-06-30 10:45:54 +02:00
< div className = "card__content" >
2018-03-26 23:32:43 +02:00
< FormField
2017-06-30 10:45:54 +02:00
type = "radio"
2018-03-26 23:32:43 +02:00
name = "content_free"
postfix = { _ _ ( 'Free' ) }
checked = { contentIsFree }
disabled = { formDisabled }
onChange = { ( ) => updatePublishForm ( { contentIsFree : true } ) }
2017-06-30 10:45:54 +02:00
/ >
< FormField
type = "radio"
2018-03-26 23:32:43 +02:00
name = "content_cost"
postfix = { _ _ ( 'Choose price' ) }
checked = { ! contentIsFree }
disabled = { formDisabled }
onChange = { ( ) => updatePublishForm ( { contentIsFree : false } ) }
2017-06-30 10:45:54 +02:00
/ >
2018-04-12 01:41:53 +02:00
{ ! contentIsFree && (
< FormFieldPrice
name = "content_cost_amount"
min = "0"
price = { price }
onChange = { newPrice => updatePublishForm ( { price : newPrice } ) }
/ >
) }
2018-03-26 23:32:43 +02:00
{ price . currency !== 'LBC' && (
< p className = "form-field__help" >
2017-11-21 20:51:12 +01:00
{ _ _ (
2017-12-21 22:08:54 +01:00
'All content fees are charged in LBC. For non-LBC payment methods, the number of credits charged will be adjusted based on the value of LBRY credits at the time of purchase.'
2017-11-21 20:51:12 +01:00
) }
2018-03-26 23:32:43 +02:00
< / p >
) }
2017-10-14 21:41:04 +02:00
< / div >
< / section >
2017-06-30 10:45:54 +02:00
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2018-12-19 06:44:53 +01:00
< header className = "card__header" >
< h2 className = "card__title" > { _ _ ( 'Anonymous or under a channel?' ) } < / h2 >
< p className = "card__subtitle" >
{ _ _ ( 'This is a username or handle that your content can be found under.' ) } { ' ' }
{ _ _ ( 'Ex. @Marvel, @TheBeatles, @BooksByJoe' ) }
< / p >
< / header >
< div className = "card__content" >
< ChannelSection channel = { channel } onChannelChange = { this . handleChannelChange } / >
< / div >
2018-03-26 23:32:43 +02:00
< / section >
2017-11-21 20:51:12 +01:00
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2018-12-19 06:44:53 +01:00
< header className = "card__header" >
< h2 className = "card__title" > { _ _ ( 'Where can people find this content?' ) } < / h2 >
< p className = "card__subtitle" >
{ _ _ (
'The LBRY URL is the exact address where people find your content (ex. lbry://myvideo).'
) } { ' ' }
< Button button = "link" label = { _ _ ( 'Learn more' ) } href = "https://lbry.io/faq/naming" / >
< / p >
< / header >
2018-03-26 23:32:43 +02:00
< div className = "card__content" >
< FormRow >
< FormField
stretch
2018-09-25 02:17:08 +02:00
label = { _ _ ( 'Name' ) }
2018-03-26 23:32:43 +02:00
prefix = { ` lbry:// ${
2018-04-04 01:17:40 +02:00
! channel || channel === CHANNEL _ANONYMOUS || channel === CHANNEL _NEW
? ''
: ` ${ channel } / `
2018-09-25 02:17:08 +02:00
} ` }
2017-11-21 20:51:12 +01:00
type = "text"
2018-03-26 23:32:43 +02:00
name = "content_name"
placeholder = "myname"
value = { name }
onChange = { event => this . handleNameChange ( event . target . value ) }
error = { nameError }
helper = {
2018-09-25 02:17:08 +02:00
< NameHelpText
2018-06-12 07:11:17 +02:00
isStillEditing = { isStillEditing }
uri = { uri }
2018-04-06 08:22:35 +02:00
myClaimForUri = { myClaimForUri }
2018-03-26 23:32:43 +02:00
onEditMyClaim = { this . editExistingClaim }
/ >
}
2017-11-21 20:51:12 +01:00
/ >
2018-03-26 23:32:43 +02:00
< / FormRow >
< / div >
2018-12-19 06:44:53 +01:00
2018-03-26 23:32:43 +02:00
< div className = { classnames ( 'card__content' , { 'card--disabled' : ! name } ) } >
< FormField
className = "input--price-amount"
type = "number"
name = "content_bid"
step = "any"
label = { _ _ ( 'Deposit' ) }
postfix = "LBC"
2018-10-19 22:38:07 +02:00
value = { bid }
2018-03-26 23:32:43 +02:00
error = { bidError }
min = "0"
disabled = { ! name }
onChange = { event => this . handleBidChange ( parseFloat ( event . target . value ) ) }
placeholder = { winningBidForClaimUri ? winningBidForClaimUri + 0.1 : 0.1 }
2018-09-25 02:17:08 +02:00
helper = {
< BidHelpText
uri = { shortUri }
isResolvingUri = { isResolvingUri }
amountNeededForTakeover = { amountNeededForTakeover }
/ >
}
2018-03-26 23:32:43 +02:00
/ >
2017-06-30 10:45:54 +02:00
< / div >
< / section >
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2018-12-19 06:44:53 +01:00
< div className = "card__content" >
< FormRow >
< FormField
type = "checkbox"
name = "content_is_mature"
postfix = { _ _ ( 'Mature audiences only' ) }
checked = { nsfw }
onChange = { event => updatePublishForm ( { nsfw : event . target . checked } ) }
/ >
< / FormRow >
< FormRow padded >
< FormField
label = { _ _ ( 'Language' ) }
type = "select"
name = "content_language"
value = { language }
onChange = { event => updatePublishForm ( { language : event . target . value } ) }
>
< 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 >
2019-01-16 11:43:22 +01:00
< option value = "id" > { _ _ ( 'Indonesian' ) } < / option >
< option value = "it" > { _ _ ( 'Italian' ) } < / option >
< option value = "nl" > { _ _ ( 'Dutch' ) } < / option >
< option value = "tr" > { _ _ ( 'Turkish' ) } < / option >
< option value = "pl" > { _ _ ( 'Polish' ) } < / option >
< option value = "ms" > { _ _ ( 'Malay' ) } < / option >
2018-12-19 06:44:53 +01:00
< / FormField >
< / FormRow >
< LicenseType
licenseType = { licenseType }
otherLicenseDescription = { otherLicenseDescription }
licenseUrl = { licenseUrl }
handleLicenseChange = { ( newLicenseType , newLicenseUrl ) =>
updatePublishForm ( {
licenseType : newLicenseType ,
licenseUrl : newLicenseUrl ,
} )
}
handleLicenseDescriptionChange = { event =>
updatePublishForm ( {
otherLicenseDescription : event . target . value ,
} )
}
handleLicenseUrlChange = { event =>
updatePublishForm ( { licenseUrl : event . target . value } )
}
2017-06-30 10:45:54 +02:00
/ >
2018-12-19 06:44:53 +01:00
< / div >
< / section >
2018-03-26 23:32:43 +02:00
2018-12-19 06:44:53 +01:00
< section className = "card card--section" >
< div className = "card__content" >
{ _ _ ( 'By continuing, you accept the' ) } { ' ' }
< Button
button = "link"
href = "https://www.lbry.io/termsofservice"
label = { _ _ ( 'LBRY Terms of Service' ) }
/ >
.
< / div >
< / section >
2018-03-26 23:32:43 +02:00
2018-12-19 06:44:53 +01:00
< section className = "card card--section" >
< div className = "card__content" >
< div className = "card__actions" >
< Submit
label = { submitLabel }
disabled = {
formDisabled ||
! formValid ||
uploadThumbnailStatus === THUMBNAIL _STATUSES . IN _PROGRESS
}
/ >
< Button button = "alt" onClick = { this . handleCancelPublish } label = { _ _ ( 'Cancel' ) } / >
< / div >
< / div >
2017-06-30 10:45:54 +02:00
< / section >
2018-03-26 23:32:43 +02:00
{ ! formDisabled && ! formValid && this . renderFormErrors ( ) }
< / div >
< / Form >
2017-06-30 10:45:54 +02:00
) ;
}
}
export default PublishForm ;