action_bar had a poor merge conflict correction fixed.

Still experimenting with updating nested state
This commit is contained in:
crockwave 2020-08-11 18:41:03 -05:00
parent 207750aef4
commit 0f70fde172
2 changed files with 41 additions and 31 deletions

View file

@ -81,8 +81,8 @@ class ActionBar extends React.PureComponent {
menu.push(null); menu.push(null);
menu.push({ text: intl.formatMessage(messages.keyboard_shortcuts), action: this.handleHotkeyClick }); menu.push({ text: intl.formatMessage(messages.keyboard_shortcuts), action: this.handleHotkeyClick });
if (isStaff) { if (isStaff) {
menu.push({ text: intl.formatMessage(messages.admin_settings), href: '/pleroma/admin/' });
menu.push({ text: intl.formatMessage(messages.admin_settings), href: '/pleroma/admin/', newTab: true }); menu.push({ text: intl.formatMessage(messages.admin_settings), href: '/pleroma/admin/', newTab: true });
menu.push({ text: intl.formatMessage(messages.soapbox_settings), href: '/admin/' });
} }
menu.push({ text: intl.formatMessage(messages.preferences), to: '/settings/preferences' }); menu.push({ text: intl.formatMessage(messages.preferences), to: '/settings/preferences' });
menu.push({ text: intl.formatMessage(messages.security), to: '/auth/edit' }); menu.push({ text: intl.formatMessage(messages.security), to: '/auth/edit' });

View file

@ -19,7 +19,6 @@ import {
Map as ImmutableMap, Map as ImmutableMap,
List as ImmutableList, List as ImmutableList,
getIn, getIn,
mergeDeep,
} from 'immutable'; } from 'immutable';
import { postSoapbox } from 'soapbox/actions/soapbox'; import { postSoapbox } from 'soapbox/actions/soapbox';
@ -63,23 +62,30 @@ class ConfigSoapbox extends ImmutablePureComponent {
// this.state = ImmutableMap(props.soapbox); // this.state = ImmutableMap(props.soapbox);
console.log(JSON.stringify(this.state, null, 2)); console.log(JSON.stringify(this.state, null, 2));
if (!this.state.logo) { if (!this.state.logo) {
this.state.logo = ''; this.state.concat({ logo: '' });
} }
if (!this.state.banner) { if (!this.state.banner) {
this.state.banner = ''; this.state.concat({ banner: '' });
} }
if (getIn(this.state, ['defaultSettings', 'autoPlayGif'], 'notSet') === 'notSet') { if (getIn(this.state, ['defaultSettings', 'autoPlayGif'], 'notSet') === 'notSet') {
this.state.defaultSettings.autoPlayGif = false; this.state.concat({ defaultSettings: { autoPlayGif: false } });
}; };
if (getIn(this.state, ['extensions', 'patron'], 'notSet') === 'notSet') { if (getIn(this.state, ['extensions', 'patron'], 'notSet') === 'notSet') {
this.state.extensions.patron = false; this.state.concat({ extensions: { patron: false } });
// this.state.extensions.patron = false;
}; };
if (getIn(this.state, ['promoPanel', 'items', 'icon'], 'notSet') === 'notSet') { if (getIn(this.state, ['promoPanel', 'items', 'icon'], 'notSet') === 'notSet') {
mergeDeep(this.state, { promoPanel: { items: [ { this.state = {
promoPanel: {
items: [
{
icon: '', icon: '',
text: '', text: '',
url: '', url: '',
} ] } }); },
],
},
};
// this.state.promoPanel.items = ImmutableList([ // this.state.promoPanel.items = ImmutableList([
// ImmutableMap({ // ImmutableMap({
// icon: '', // icon: '',
@ -120,7 +126,7 @@ class ConfigSoapbox extends ImmutablePureComponent {
} }
getParams = () => { getParams = () => {
const { state } = this; // const { state } = this;
var obj = { var obj = {
configs: [{ configs: [{
group: ':pleroma', group: ':pleroma',
@ -128,23 +134,23 @@ class ConfigSoapbox extends ImmutablePureComponent {
value: [{ value: [{
tuple: [':soapbox_fe', tuple: [':soapbox_fe',
{ {
logo: '', // logo: '',
banner: '', // banner: '',
brandColor: '', // brandColor: '',
customCss: [], // customCss: [],
promoPanel: { // promoPanel: {
items: [], // items: [],
}, // },
extensions: { // extensions: {
patron: false, // patron: false,
}, // },
defaultSettings: { // defaultSettings: {
autoPlayGif: false, // autoPlayGif: false,
}, // },
copyright: '', // copyright: '',
navlinks: { // navlinks: {
homeFooter: [], // homeFooter: [],
}, // },
}, },
], ],
}], }],
@ -292,10 +298,14 @@ class ConfigSoapbox extends ImmutablePureComponent {
render() { render() {
const { intl } = this.props; const { intl } = this.props;
const { logo, banner, brandColor, extensions, defaultSettings, copyright, // const { logo, banner, brandColor, extensions, defaultSettings, copyright,
promoPanel, navlinks, customCss } = this.state; // promoPanel, navlinks, customCss } = this.state;
const patron = false; const patron = false;
const autoPlayGif = false; const autoPlayGif = false;
const logo = '';
const banner = '';
const brandColor = '#3b5998';
const copyright = '';
// const patron = (extensions.patron === 'true'); // const patron = (extensions.patron === 'true');
// const autoPlayGif = (defaultSettings.autoPlayGif === 'true'); // const autoPlayGif = (defaultSettings.autoPlayGif === 'true');
// console.log(navlinks.homeFooter); // console.log(navlinks.homeFooter);