From d772983278abb823027108768ebb7a9fcdd61b9e Mon Sep 17 00:00:00 2001 From: Curtis ROck Date: Sat, 25 Jul 2020 09:55:01 -0500 Subject: [PATCH] edited features/configuration --- app/soapbox/features/configuration/index.js | 87 +++++++++++++++------ 1 file changed, 61 insertions(+), 26 deletions(-) diff --git a/app/soapbox/features/configuration/index.js b/app/soapbox/features/configuration/index.js index ded7e007b..5bdc28d4a 100644 --- a/app/soapbox/features/configuration/index.js +++ b/app/soapbox/features/configuration/index.js @@ -16,7 +16,7 @@ import { import StillImage from 'soapbox/components/still_image'; import { Map as ImmutableMap, - // List as ImmutableList, + List as ImmutableList, } from 'immutable'; import { patchMe } from 'soapbox/actions/me'; //import { unescape } from 'lodash'; @@ -36,6 +36,7 @@ const mapStateToProps = state => { const soapbox = state.get('soapbox'); return { themeCss: generateThemeCss(soapbox.get('brandColor')), + brandColor: soapbox.get('brandColor'), customCssItems: soapbox.getIn(['customCSS', 'items']), logo: soapbox.get('logo'), banner: soapbox.get('banner'), @@ -56,6 +57,7 @@ class ConfigSoapbox extends ImmutablePureComponent { dispatch: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, themeCss: PropTypes.string, + brandColor: PropTypes.string, customCssItems: ImmutablePropTypes.list, logo: PropTypes.string, banner: PropTypes.string, @@ -79,6 +81,36 @@ class ConfigSoapbox extends ImmutablePureComponent { homeFooterItems: props.homeFooterItems, customCssItems: props.customCssItems, }; + if (!this.state.logo) { + this.state.logo = ''; + } + if (!this.state.banner) { + this.state.banner = ''; + } + if (!this.state.promoItems) { + this.state.promoItems = ImmutableList([ + ImmutableMap({ + icon: '', + text: '', + url: '', + }), + ]); + }; + if (!this.state.homeFooterItems) { + this.state.homeFooterItems = ImmutableList([ + ImmutableMap({ + title: '', + url: '', + }), + ]); + }; + if (!this.state.customCssItems) { + this.state.customCssItems = ImmutableList([ + ImmutableMap({ + css: '', + }), + ]); + }; } getPromoItemsParams = () => { @@ -150,6 +182,10 @@ class ConfigSoapbox extends ImmutablePureComponent { this.setState({ [e.target.name]: e.target.checked }); } + handleBrandColorChange = e => { + this.setState({ brandColor: e.target.value }); + } + handleTextChange = e => { this.setState({ [e.target.name]: e.target.value }); } @@ -226,8 +262,9 @@ class ConfigSoapbox extends ImmutablePureComponent {
-

- +

+

+
@@ -313,29 +350,27 @@ class ConfigSoapbox extends ImmutablePureComponent { -
-
- - - - - { - this.state.customCssItems.map((field, i) => ( -
- -
- )) - } -
- -
+
+ + + + + { + this.state.customCssItems.map((field, i) => ( +
+ +
+ )) + } +
+