2020-07-20 16:18:54 -07:00
import React from 'react' ;
import { connect } from 'react-redux' ;
import { defineMessages , injectIntl , FormattedMessage } from 'react-intl' ;
import ImmutablePureComponent from 'react-immutable-pure-component' ;
import PropTypes from 'prop-types' ;
import ImmutablePropTypes from 'react-immutable-proptypes' ;
import Column from '../ui/components/column' ;
import {
SimpleForm ,
FieldsGroup ,
2020-07-21 06:30:51 -07:00
TextInput ,
Checkbox ,
FileChooser ,
2020-08-02 13:41:26 -07:00
ColorWithPicker ,
2020-08-02 12:07:13 -07:00
FileChooserLogo ,
2020-07-20 16:18:54 -07:00
} from 'soapbox/features/forms' ;
2020-07-22 17:31:41 -07:00
import StillImage from 'soapbox/components/still_image' ;
2020-07-21 06:30:51 -07:00
import {
Map as ImmutableMap ,
2020-08-13 20:25:06 -07:00
List as ImmutableList ,
2020-08-12 18:52:32 -07:00
getIn ,
2020-07-21 06:30:51 -07:00
} from 'immutable' ;
2020-07-30 17:39:41 -07:00
import { postSoapbox } from 'soapbox/actions/soapbox' ;
2020-07-20 16:18:54 -07:00
const messages = defineMessages ( {
2020-07-21 16:38:10 -07:00
heading : { id : 'column.soapbox_settings' , defaultMessage : 'Soapbox settings' } ,
2020-08-02 18:10:32 -07:00
copyrightFooterLabel : { id : 'soapbox_settings.copyright_footer.meta_fields.label_placeholder' , defaultMessage : 'Copyright footer' } ,
2020-07-23 17:45:34 -07:00
promoItemIcon : { id : 'soapbox_settings.promo_panel.meta_fields.icon_placeholder' , defaultMessage : 'Icon' } ,
promoItemLabel : { id : 'soapbox_settings.promo_panel.meta_fields.label_placeholder' , defaultMessage : 'Label' } ,
promoItemURL : { id : 'soapbox_settings.promo_panel.meta_fields.url_placeholder' , defaultMessage : 'URL' } ,
homeFooterItemLabel : { id : 'soapbox_settings.home_footer.meta_fields.label_placeholder' , defaultMessage : 'Label' } ,
homeFooterItemURL : { id : 'soapbox_settings.home_footer.meta_fields.url_placeholder' , defaultMessage : 'URL' } ,
2020-07-25 16:27:39 -07:00
customCssLabel : { id : 'soapbox_settings.custom_css.meta_fields.url_placeholder' , defaultMessage : 'URL' } ,
2020-07-20 16:18:54 -07:00
} ) ;
2020-07-21 06:30:51 -07:00
const mapStateToProps = state => {
return {
2020-08-09 09:03:24 -07:00
soapbox : state . get ( 'soapbox' ) ,
2020-07-21 06:30:51 -07:00
} ;
} ;
2020-07-20 16:18:54 -07:00
export default @ connect ( mapStateToProps )
@ injectIntl
2020-07-21 06:30:51 -07:00
class ConfigSoapbox extends ImmutablePureComponent {
2020-07-20 16:18:54 -07:00
static propTypes = {
2020-08-09 09:03:24 -07:00
soapbox : ImmutablePropTypes . map ,
2020-07-20 16:18:54 -07:00
dispatch : PropTypes . func . isRequired ,
intl : PropTypes . object . isRequired ,
} ;
2020-07-21 06:30:51 -07:00
state = {
isLoading : false ,
}
2020-08-13 20:25:06 -07:00
constructor ( props ) {
super ( props ) ;
2020-08-14 14:51:04 -07:00
var promoPanelItems = getIn ( this . props . soapbox , [ 'promoPanel' ] , [ 'items' ] , [ ] ) . get ( 'items' ) ;
if ( promoPanelItems . size === 0 ) {
2020-08-13 20:25:06 -07:00
this . state . promoPanelItems = ImmutableList ( [
ImmutableMap ( {
icon : '' ,
text : '' ,
url : '' ,
} ) ,
] ) ;
2020-08-14 14:51:04 -07:00
} else {
this . state . promoPanelItems = promoPanelItems ;
2020-08-13 20:25:06 -07:00
} ;
2020-08-14 14:51:04 -07:00
var homeFooterItems = getIn ( this . props . soapbox , [ 'navlinks' ] , [ 'homefooter' ] , [ ] ) . get ( 'homeFooter' ) ;
if ( homeFooterItems . size === 0 ) {
2020-08-13 20:25:06 -07:00
this . state . homeFooterItems = ImmutableList ( [
ImmutableMap ( {
title : '' ,
url : '' ,
} ) ,
] ) ;
2020-08-14 14:51:04 -07:00
} else {
this . state . homeFooterItems = homeFooterItems ;
2020-08-13 20:25:06 -07:00
} ;
2020-08-14 14:51:04 -07:00
var customCssItems = getIn ( this . props . soapbox , [ 'customCss' ] , [ ] ) ;
if ( customCssItems . size === 0 ) {
2020-08-13 20:25:06 -07:00
this . state . customCssItems = ImmutableList ( [ '' ] ) ;
2020-08-14 14:51:04 -07:00
} else {
this . state . customCssItems = customCssItems ;
2020-08-13 20:25:06 -07:00
} ;
2020-08-14 17:03:11 -07:00
this . state . patron = getIn ( this . props . soapbox , [ 'extensions' , 'patron' ] , false ) ;
this . state . autoPlayGif = getIn ( this . props . soapbox , [ 'defaultSettings' , 'autoPlayGif' ] , false ) ;
2020-08-13 20:25:06 -07:00
this . handlecustomCSSChange = this . handleCustomCSSChange . bind ( this ) ;
2020-08-14 17:03:11 -07:00
this . handleAutoPlayGifCheckboxChange = this . handleAutoPlayGifCheckboxChange . bind ( this ) ;
this . handlePatronCheckboxChange = this . handlePatronCheckboxChange . bind ( this ) ;
2020-08-13 20:25:06 -07:00
}
2020-07-23 07:14:28 -07:00
2020-07-21 06:30:51 -07:00
getParams = ( ) => {
2020-08-12 15:24:14 -07:00
const { state } = this ;
2020-07-29 17:09:44 -07:00
var obj = {
configs : [ {
group : ':pleroma' ,
key : ':frontend_configurations' ,
value : [ {
tuple : [ ':soapbox_fe' ,
{
2020-08-12 15:24:14 -07:00
logo : '' ,
banner : '' ,
brandColor : '' ,
customCss : [ ] ,
promoPanel : {
items : [ ] ,
} ,
extensions : {
patron : false ,
} ,
defaultSettings : {
autoPlayGif : false ,
} ,
copyright : '' ,
navlinks : {
homeFooter : [ ] ,
} ,
2020-07-29 17:09:44 -07:00
} ,
] ,
} ] ,
} ] ,
} ;
2020-08-14 14:51:04 -07:00
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . logo = ( state . logo ? state . logo : getIn ( this . props . soapbox , [ 'logo' ] , '' ) ) ;
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . banner = ( state . banner ? state . banner : getIn ( this . props . soapbox , [ 'banner' ] , '' ) ) ;
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . brandColor = ( state . brandColor ? state . brandColor : getIn ( this . props . soapbox , [ 'brandColor' ] , '' ) ) ;
2020-08-14 17:03:11 -07:00
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . extensions . patron = ( state . patron !== undefined ? state . patron : getIn ( this . props . soapbox , [ 'extensions' , 'patron' ] , false ) ) ;
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . defaultSettings . autoPlayGif = ( state . autoPlayGif !== undefined ? state . autoPlayGif : getIn ( this . props . soapbox , [ 'defaultSettings' , 'autoPlayGif' ] , false ) ) ;
2020-08-14 14:51:04 -07:00
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . copyright = ( state . copyright ? state . copyright : getIn ( this . props . soapbox , [ 'copyright' ] , '' ) ) ;
var homeFooterItems = ( state . homeFooterItems ? state . homeFooterItems : getIn ( this . props . soapbox , [ 'navlinks' ] , [ 'homeFooter' ] , [ ] ) ) ;
2020-08-12 15:24:14 -07:00
homeFooterItems . forEach ( ( f ) =>
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . navlinks . homeFooter . push ( { title : f . get ( 'title' ) , url : f . get ( 'url' ) } )
) ;
2020-08-14 14:51:04 -07:00
var promoPanelItems = ( state . promoPanelItems ? state . promoPanelItems : getIn ( this . props . soapbox , [ 'promoPanel' ] , [ 'items' ] , [ ] ) ) ;
2020-08-12 15:24:14 -07:00
promoPanelItems . forEach ( ( f ) =>
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . promoPanel . items . push ( { icon : f . get ( 'icon' ) , text : f . get ( 'text' ) , url : f . get ( 'url' ) } )
) ;
2020-08-14 14:51:04 -07:00
var customCssItems = ( state . customCssItems ? state . customCssItems : getIn ( this . props . soapbox , [ 'customCss' ] , [ ] ) ) ;
2020-08-12 15:24:14 -07:00
customCssItems . forEach ( ( f ) =>
obj . configs [ 0 ] . value [ 0 ] . tuple [ 1 ] . customCss . push ( f )
) ;
2020-08-01 14:38:29 -07:00
return obj ;
2020-07-21 06:30:51 -07:00
}
handleSubmit = ( event ) => {
2020-07-20 16:18:54 -07:00
const { dispatch } = this . props ;
2020-07-30 17:39:41 -07:00
dispatch ( postSoapbox ( this . getParams ( ) ) ) . then ( ( ) => {
2020-07-21 06:30:51 -07:00
this . setState ( { isLoading : false } ) ;
} ) . catch ( ( error ) => {
this . setState ( { isLoading : false } ) ;
} ) ;
this . setState ( { isLoading : true } ) ;
event . preventDefault ( ) ;
}
2020-08-12 15:24:14 -07:00
handlePatronCheckboxChange = e => {
2020-08-13 20:25:06 -07:00
this . setState ( { patron : ! this . state . patron } ) ;
2020-08-09 09:03:24 -07:00
}
2020-08-12 15:24:14 -07:00
handleAutoPlayGifCheckboxChange = e => {
2020-08-13 20:25:06 -07:00
this . setState ( { autoPlayGif : ! this . state . autoPlayGif } ) ;
2020-07-21 06:30:51 -07:00
}
2020-07-25 07:55:01 -07:00
handleBrandColorChange = e => {
2020-08-09 09:03:24 -07:00
this . setState ( {
brandColor : e . hex ,
} ) ;
2020-07-25 07:55:01 -07:00
}
2020-07-21 06:30:51 -07:00
handleTextChange = e => {
2020-08-09 09:03:24 -07:00
this . setState ( {
[ e . target . name ] : e . target . value ,
} ) ;
2020-07-21 06:30:51 -07:00
}
2020-07-23 17:45:34 -07:00
handlePromoItemsChange = ( i , key ) => {
2020-07-21 06:30:51 -07:00
return ( e ) => {
this . setState ( {
2020-08-13 20:25:06 -07:00
promoPanelItems : this . state . promoPanelItems . setIn ( [ i , key ] , e . target . value ) ,
2020-07-21 06:30:51 -07:00
} ) ;
} ;
}
2020-07-23 17:45:34 -07:00
handleHomeFooterItemsChange = ( i , key ) => {
2020-07-23 07:14:28 -07:00
return ( e ) => {
this . setState ( {
2020-08-12 15:24:14 -07:00
homeFooterItems : this . state . homeFooterItems . setIn ( [ i , key ] , e . target . value ) ,
2020-07-23 07:14:28 -07:00
} ) ;
} ;
}
2020-07-27 17:16:02 -07:00
handleCustomCSSChange = i => {
2020-07-24 17:30:33 -07:00
return ( e ) => {
this . setState ( {
2020-08-12 15:24:14 -07:00
customCssItems : this . state . customCssItems . setIn ( [ i ] , e . target . value ) ,
2020-07-24 17:30:33 -07:00
} ) ;
} ;
}
2020-07-21 06:30:51 -07:00
handleFileChange = e => {
const { name } = e . target ;
const [ file ] = e . target . files || [ ] ;
const url = file ? URL . createObjectURL ( file ) : this . state [ name ] ;
this . setState ( {
[ name ] : url ,
[ ` ${ name } _file ` ] : file ,
} ) ;
2020-07-20 16:18:54 -07:00
}
2020-07-25 21:31:39 -07:00
handleAddPromoPanelItem = ( ) => {
2020-08-11 04:30:54 -07:00
2020-07-25 21:31:39 -07:00
this . setState ( {
2020-08-12 15:24:14 -07:00
promoPanelItems : this . state . promoPanelItems . concat ( [
2020-07-25 21:31:39 -07:00
ImmutableMap ( {
icon : '' ,
text : '' ,
url : '' ,
} ) ,
] ) ,
} ) ;
}
handleAddHomeFooterItem = ( ) => {
this . setState ( {
2020-08-12 15:24:14 -07:00
homeFooterItems : this . state . homeFooterItems . concat ( [
2020-07-25 21:31:39 -07:00
ImmutableMap ( {
title : '' ,
url : '' ,
} ) ,
] ) ,
} ) ;
}
2020-07-28 17:29:20 -07:00
handleAddCssItem = ( ) => {
2020-07-25 21:31:39 -07:00
this . setState ( {
2020-08-12 15:24:14 -07:00
customCssItems : this . state . customCssItems . concat ( [ '' ] ) ,
2020-07-25 21:31:39 -07:00
} ) ;
}
2020-07-20 16:18:54 -07:00
render ( ) {
2020-08-12 18:52:32 -07:00
const { intl } = this . props ;
const logo = ( this . state . logo ? this . state . logo : getIn ( this . props . soapbox , [ 'logo' ] , '' ) ) ;
const banner = ( this . state . banner ? this . state . banner : getIn ( this . props . soapbox , [ 'banner' ] , '' ) ) ;
const brandColor = ( this . state . brandColor ? this . state . brandColor : getIn ( this . props . soapbox , [ 'brandColor' ] , '' ) ) ;
2020-08-14 17:03:11 -07:00
const patron = ( this . state . patron !== undefined ? this . state . patron : getIn ( this . props . soapbox , [ 'extensions' , 'patron' ] , false ) ) ;
const autoPlayGif = ( this . state . autoPlayGif !== undefined ? this . state . autoPlayGif : getIn ( this . props . soapbox , [ 'defaultSettings' , 'autoPlayGif' ] , false ) ) ;
2020-08-14 14:51:04 -07:00
const promoPanelItems = ( this . state . promoPanelItems ? this . state . promoPanelItems : getIn ( this . props . soapbox , [ 'promoPanel' ] , [ 'items' ] , [ ] ) . get ( 'items' ) ) ;
const homeFooterItems = ( this . state . homeFooterItems ? this . state . homeFooterItems : getIn ( this . props . soapbox , [ 'navlinks' ] , [ 'homeFooter' ] , [ ] ) . get ( 'homeFooter' ) ) ;
2020-08-12 18:52:32 -07:00
const customCssItems = ( this . state . customCssItems ? this . state . customCssItems : getIn ( this . props . soapbox , [ 'customCss' ] , [ ] ) ) ;
const copyright = ( this . state . copyright ? this . state . copyright : getIn ( this . props . soapbox , [ 'copyright' ] , '' ) ) ;
2020-07-20 16:18:54 -07:00
return (
2020-07-24 17:30:33 -07:00
< Column icon = 'shield' heading = { intl . formatMessage ( messages . heading ) } backBtnSlim >
2020-07-21 06:30:51 -07:00
< SimpleForm onSubmit = { this . handleSubmit } >
< fieldset disabled = { this . state . isLoading } >
< FieldsGroup >
< div className = 'fields-row' >
< div className = 'fields-row__column fields-row__column-6' >
2020-08-12 18:52:32 -07:00
< StillImage src = { logo } / >
2020-07-21 06:30:51 -07:00
< / d i v >
< div className = 'fields-row__column fields-group fields-row__column-6' >
2020-08-02 12:07:13 -07:00
< FileChooserLogo
2020-07-23 17:45:34 -07:00
label = { < FormattedMessage id = 'soapbox_settings.fields.logo_label' defaultMessage = 'Logo' / > }
name = 'logo'
hint = { < FormattedMessage id = 'soapbox_settings.hints.logo' defaultMessage = 'SVG. At most 2 MB. Will be downscaled to 50px height, maintaining aspect ratio' / > }
2020-07-21 06:30:51 -07:00
onChange = { this . handleFileChange }
/ >
2020-07-24 17:30:33 -07:00
< / d i v >
< / d i v >
< div className = 'fields-row' >
< div className = 'fields-row__column fields-row__column-6' >
2020-08-12 15:24:14 -07:00
{ this . state . banner ? ( < StillImage src = { this . state . banner } / > ) : ( < StillImage src = { banner || '' } / > ) }
2020-07-24 17:30:33 -07:00
< / d i v >
< div className = 'fields-row__column fields-group fields-row__column-6' >
2020-07-21 06:30:51 -07:00
< FileChooser
2020-07-23 17:45:34 -07:00
label = { < FormattedMessage id = 'soapbox_settings.fields.banner_label' defaultMessage = 'Banner' / > }
name = 'banner'
hint = { < FormattedMessage id = 'soapbox_settings.hints.banner' defaultMessage = 'PNG, GIF or JPG. At most 2 MB. Will be downscaled to 400x400px' / > }
2020-07-21 06:30:51 -07:00
onChange = { this . handleFileChange }
/ >
< / d i v >
< / d i v >
2020-07-24 17:30:33 -07:00
< / F i e l d s G r o u p >
< FieldsGroup >
2020-08-02 13:41:26 -07:00
< div className = 'fields-row__column fields-group' >
< ColorWithPicker
buttonId = 'brand_color'
label = { < FormattedMessage id = 'soapbox_settings.fields.brand_color_label' defaultMessage = 'Brand color' / > }
2020-08-12 18:52:32 -07:00
value = { brandColor }
2020-08-02 13:41:26 -07:00
onChange = { this . handleBrandColorChange }
/ >
2020-07-24 17:30:33 -07:00
< / d i v >
< / F i e l d s G r o u p >
< FieldsGroup >
2020-07-21 06:30:51 -07:00
< Checkbox
2020-07-24 17:30:33 -07:00
label = { < FormattedMessage id = 'soapbox_settings.fields.patron_enabled_label' defaultMessage = 'Patron module' / > }
2020-07-23 17:45:34 -07:00
hint = { < FormattedMessage id = 'soapbox_settings.hints.patron_enabled' defaultMessage = 'Enables display of Patron module. Requires installation of Patron module.' / > }
2020-08-09 09:03:24 -07:00
name = 'patron'
2020-08-12 18:52:32 -07:00
checked = { patron }
2020-08-12 15:24:14 -07:00
onChange = { this . handlePatronCheckboxChange }
2020-07-20 16:18:54 -07:00
/ >
2020-07-21 06:30:51 -07:00
< Checkbox
2020-07-23 17:45:34 -07:00
label = { < FormattedMessage id = 'soapbox_settings.fields.auto_play_gif_label' defaultMessage = 'Auto-play GIFs' / > }
hint = { < FormattedMessage id = 'soapbox_settings.hints.auto_play_gif' defaultMessage = 'Enable auto-playing of GIF files in timeline' / > }
2020-07-25 16:27:39 -07:00
name = 'autoPlayGif'
2020-08-12 18:52:32 -07:00
checked = { autoPlayGif }
2020-08-12 15:24:14 -07:00
onChange = { this . handleAutoPlayGifCheckboxChange }
2020-07-20 16:18:54 -07:00
/ >
2020-07-21 06:30:51 -07:00
< / F i e l d s G r o u p >
2020-08-02 17:44:04 -07:00
< FieldsGroup >
< TextInput
name = 'copyright'
label = { intl . formatMessage ( messages . copyrightFooterLabel ) }
placeholder = { intl . formatMessage ( messages . copyrightFooterLabel ) }
2020-08-12 18:52:32 -07:00
value = { copyright }
2020-08-02 17:44:04 -07:00
onChange = { this . handleTextChange }
/ >
< / F i e l d s G r o u p >
2020-08-12 15:24:14 -07:00
< FieldsGroup >
2020-07-21 06:30:51 -07:00
< div className = 'fields-row__column fields-group' >
< div className = 'input with_block_label' >
2020-07-24 17:30:33 -07:00
< label > < FormattedMessage id = 'soapbox_settings.fields.promo_panel_fields_label' defaultMessage = 'Promo panel items' / > < / l a b e l >
2020-07-21 06:30:51 -07:00
< span className = 'hint' >
2020-07-25 16:27:39 -07:00
< FormattedMessage id = 'soapbox_settings.hints.promo_panel_fields' defaultMessage = 'You can have custom defined links displayed on the left panel of the timelines page.' / >
< / s p a n >
< span className = 'hint' >
< FormattedMessage id = 'soapbox_settings.hints.promo_panel_icons' defaultMessage = '{ link }' values = { { link : < a target = '_blank' href = 'https://forkaweso.me/Fork-Awesome/icons/' > Soapbox Icons List < /a> }} / >
2020-07-21 06:30:51 -07:00
< / s p a n >
{
2020-08-12 18:52:32 -07:00
promoPanelItems . valueSeq ( ) . map ( ( field , i ) => (
2020-07-21 06:30:51 -07:00
< div className = 'row' key = { i } >
< TextInput
2020-07-24 17:30:33 -07:00
label = { intl . formatMessage ( messages . promoItemIcon ) }
placeholder = { intl . formatMessage ( messages . promoItemIcon ) }
value = { field . get ( 'icon' ) }
onChange = { this . handlePromoItemsChange ( i , 'icon' ) }
2020-07-21 06:30:51 -07:00
/ >
< TextInput
2020-07-24 17:30:33 -07:00
label = { intl . formatMessage ( messages . promoItemLabel ) }
placeholder = { intl . formatMessage ( messages . promoItemLabel ) }
value = { field . get ( 'text' ) }
onChange = { this . handlePromoItemsChange ( i , 'text' ) }
/ >
< TextInput
label = { intl . formatMessage ( messages . promoItemURL ) }
placeholder = { intl . formatMessage ( messages . promoItemURL ) }
value = { field . get ( 'url' ) }
onChange = { this . handlePromoItemsChange ( i , 'url' ) }
2020-07-21 06:30:51 -07:00
/ >
< / d i v >
) )
}
2020-07-24 17:30:33 -07:00
< div className = 'actions' >
2020-08-10 17:29:38 -07:00
< div name = 'button' type = 'button' role = 'presentation' className = 'btn button button-secondary' onClick = { this . handleAddPromoPanelItem } >
2020-07-24 17:30:33 -07:00
< FormattedMessage id = 'soapbox_settings.fields.promo_panel.add' defaultMessage = 'Add new Promo panel item' / >
2020-08-10 17:29:38 -07:00
< / d i v >
2020-07-24 17:30:33 -07:00
< / d i v >
2020-07-21 06:30:51 -07:00
< / d i v >
2020-07-23 07:14:28 -07:00
< div className = 'input with_block_label' >
2020-07-24 17:30:33 -07:00
< label > < FormattedMessage id = 'soapbox_settings.fields.home_footer_fields_label' defaultMessage = 'Home footer items' / > < / l a b e l >
2020-07-23 07:14:28 -07:00
< span className = 'hint' >
2020-07-24 17:30:33 -07:00
< FormattedMessage id = 'soapbox_settings.hints.home_footer_fields' defaultMessage = 'You can have custom defined links displayed on the footer of your static pages' / >
2020-07-23 07:14:28 -07:00
< / s p a n >
{
2020-08-12 18:52:32 -07:00
homeFooterItems . valueSeq ( ) . map ( ( field , i ) => (
2020-07-23 07:14:28 -07:00
< div className = 'row' key = { i } >
< TextInput
2020-07-24 17:30:33 -07:00
label = { intl . formatMessage ( messages . homeFooterItemLabel ) }
placeholder = { intl . formatMessage ( messages . homeFooterItemLabel ) }
value = { field . get ( 'title' ) }
onChange = { this . handleHomeFooterItemsChange ( i , 'title' ) }
2020-07-23 07:14:28 -07:00
/ >
< TextInput
2020-07-24 17:30:33 -07:00
label = { intl . formatMessage ( messages . homeFooterItemURL ) }
placeholder = { intl . formatMessage ( messages . homeFooterItemURL ) }
value = { field . get ( 'url' ) }
onChange = { this . handleHomeFooterItemsChange ( i , 'url' ) }
/ >
< / d i v >
) )
}
< div className = 'actions' >
2020-08-10 17:29:38 -07:00
< div name = 'button' type = 'button' role = 'presentation' className = 'btn button button-secondary' onClick = { this . handleAddHomeFooterItem } >
2020-07-24 17:30:33 -07:00
< FormattedMessage id = 'soapbox_settings.fields.home_footer.add' defaultMessage = 'Add new Home Footer Item' / >
2020-08-10 17:29:38 -07:00
< / d i v >
2020-07-24 17:30:33 -07:00
< / d i v >
< / d i v >
< / d i v >
2020-07-25 13:25:33 -07:00
< div className = 'input with_block_label' >
2020-07-25 07:55:01 -07:00
< label > < FormattedMessage id = 'soapbox_settings.fields.custom_css_fields_label' defaultMessage = 'Custom CSS' / > < / l a b e l >
< span className = 'hint' >
< FormattedMessage id = 'soapbox_settings.hints.custom_css_fields' defaultMessage = 'You can have custom CSS definitions' / >
< / s p a n >
{
2020-08-12 18:52:32 -07:00
customCssItems . valueSeq ( ) . map ( ( field , i ) => (
2020-07-25 07:55:01 -07:00
< div className = 'row' key = { i } >
< TextInput
label = { intl . formatMessage ( messages . customCssLabel ) }
placeholder = { intl . formatMessage ( messages . customCssLabel ) }
2020-07-27 17:16:02 -07:00
value = { field }
onChange = { this . handlecustomCSSChange ( i ) }
2020-07-25 07:55:01 -07:00
/ >
< / d i v >
) )
}
< div className = 'actions' >
2020-08-10 17:29:38 -07:00
< div name = 'button' type = 'button' role = 'presentation' className = 'btn button button-secondary' onClick = { this . handleAddCssItem } >
2020-07-25 07:55:01 -07:00
< FormattedMessage id = 'soapbox_settings.fields.custom_css.add' defaultMessage = 'Add new Custom CSS item' / >
2020-08-10 17:29:38 -07:00
< / d i v >
2020-07-23 07:14:28 -07:00
< / d i v >
2020-07-21 06:30:51 -07:00
< / d i v >
2020-08-12 15:24:14 -07:00
< / F i e l d s G r o u p >
2020-07-21 06:30:51 -07:00
< / f i e l d s e t >
< div className = 'actions' >
< button name = 'button' type = 'submit' className = 'btn button button-primary' >
2020-07-22 17:31:41 -07:00
< FormattedMessage id = 'soapbox_settings.save' defaultMessage = 'Save' / >
2020-07-21 06:30:51 -07:00
< / b u t t o n >
< / d i v >
2020-07-20 16:18:54 -07:00
< / S i m p l e F o r m >
< / C o l u m n >
) ;
}
}