2019-06-28 09:27:55 +02:00
// @flow
import React from 'react' ;
import { FormField , FormFieldPrice } from 'component/common/form' ;
2019-09-27 20:56:15 +02:00
import Card from 'component/common/card' ;
2019-06-28 09:27:55 +02:00
type Props = {
contentIsFree : boolean ,
fee : Fee ,
disabled : boolean ,
updatePublishForm : ( { } ) => void ,
} ;
2019-07-24 06:47:19 +02:00
function PublishPrice ( props : Props ) {
2019-06-28 09:27:55 +02:00
const { contentIsFree , fee , updatePublishForm , disabled } = props ;
return (
2022-02-11 19:50:55 +01:00
< >
< label > { _ _ ( 'Price' ) } < / label >
< Card
actions = {
< React.Fragment >
< FormField
type = "radio"
name = "content_free"
label = { _ _ ( 'Free' ) }
checked = { contentIsFree }
disabled = { disabled }
onChange = { ( ) => updatePublishForm ( { contentIsFree : true } ) }
/ >
2019-06-28 09:27:55 +02:00
2022-02-11 19:50:55 +01:00
< FormField
type = "radio"
name = "content_cost"
label = { _ _ ( 'Add a price to this file' ) }
checked = { ! contentIsFree }
disabled = { disabled }
onChange = { ( ) => updatePublishForm ( { contentIsFree : false } ) }
2019-09-27 20:56:15 +02:00
/ >
2022-02-11 19:50:55 +01:00
{ ! contentIsFree && (
< FormFieldPrice
name = "content_cost_amount"
min = { 0 }
price = { fee }
onChange = { ( newFee ) => updatePublishForm ( { fee : newFee } ) }
/ >
) }
{ fee && fee . currency !== 'LBC' && (
< p className = "form-field__help" >
{ _ _ (
'All content fees are charged in LBRY Credits. For alternative payment methods, the number of LBRY Credits charged will be adjusted based on the value of LBRY Credits at the time of purchase.'
) }
< / p >
) }
< / React.Fragment >
}
/ >
< / >
2019-06-28 09:27:55 +02:00
) ;
}
2019-07-24 06:47:19 +02:00
export default PublishPrice ;