SB settings Save works and brandcolor renders. Logo/banner paths are issues, and adding new homefooter/customCSS are issues
This commit is contained in:
parent
43f28a30ba
commit
ba18c3a643
3 changed files with 37 additions and 43 deletions
|
@ -4,8 +4,8 @@ export const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS';
|
|||
export const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
|
||||
|
||||
export const SOAPBOX_POST_REQUEST = 'SOAPBOX_POST_REQUEST';
|
||||
export const SOAPBOX_POST_SUCCESS = 'SOAPBOX_POST_REQUEST';
|
||||
export const SOAPBOX_POST_FAIL = 'SOAPBOX_POST_REQUEST';
|
||||
export const SOAPBOX_POST_SUCCESS = 'SOAPBOX_POST_SUCCESS';
|
||||
export const SOAPBOX_POST_FAIL = 'SOAPBOX_POST_FAIL';
|
||||
|
||||
export function fetchSoapboxConfig() {
|
||||
return (dispatch, getState) => {
|
||||
|
|
|
@ -113,7 +113,7 @@ class ConfigSoapbox extends ImmutablePureComponent {
|
|||
}
|
||||
|
||||
getParams = () => {
|
||||
// const { state } = this;
|
||||
const { state } = this;
|
||||
var obj = {
|
||||
configs: [{
|
||||
group: ':pleroma',
|
||||
|
@ -121,46 +121,44 @@ class ConfigSoapbox extends ImmutablePureComponent {
|
|||
value: [{
|
||||
tuple: [':soapbox_fe',
|
||||
{
|
||||
// logo: '',
|
||||
// banner: '',
|
||||
// brandColor: '',
|
||||
// customCss: [],
|
||||
// promoPanel: {
|
||||
// items: [],
|
||||
// },
|
||||
// extensions: {
|
||||
// patron: false,
|
||||
// },
|
||||
// defaultSettings: {
|
||||
// autoPlayGif: false,
|
||||
// },
|
||||
// copyright: '',
|
||||
// navlinks: {
|
||||
// homeFooter: [],
|
||||
// },
|
||||
logo: '',
|
||||
banner: '',
|
||||
brandColor: '',
|
||||
customCss: [],
|
||||
promoPanel: {
|
||||
items: [],
|
||||
},
|
||||
extensions: {
|
||||
patron: false,
|
||||
},
|
||||
defaultSettings: {
|
||||
autoPlayGif: false,
|
||||
},
|
||||
copyright: '',
|
||||
navlinks: {
|
||||
homeFooter: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
}],
|
||||
}],
|
||||
};
|
||||
// obj.configs[0].value[0].tuple[1].logo = state.logo;
|
||||
// obj.configs[0].value[0].tuple[1].banner = state.banner;
|
||||
// obj.configs[0].value[0].tuple[1].brandColor = state.brandColor;
|
||||
// obj.configs[0].value[0].tuple[1].extensions.patron = state.patronEnabled;
|
||||
// obj.configs[0].value[0].tuple[1].defaultSettings.autoPlayGif = state.autoPlayGif;
|
||||
// obj.configs[0].value[0].tuple[1].copyright = state.copyright;
|
||||
// this.state.homeFooterItems.forEach((f) =>
|
||||
// obj.configs[0].value[0].tuple[1].navlinks.homeFooter.push({ title: f.get('title'), url: f.get('url') })
|
||||
// );
|
||||
// this.state.promoItems.forEach((f) =>
|
||||
// obj.configs[0].value[0].tuple[1].promoPanel.items.push({ icon: f.get('icon'), text: f.get('text'), url: f.get('url') })
|
||||
// );
|
||||
// this.state.customCssItems.forEach((f) =>
|
||||
// obj.configs[0].value[0].tuple[1].customCss.push(f)
|
||||
// );
|
||||
console.log(JSON.stringify(obj, null, 2));
|
||||
// console.log(JSON.stringify(obj.configs[0].value[0].tuple[1], null, 2));
|
||||
return JSON.stringify(obj);
|
||||
obj.configs[0].value[0].tuple[1].logo = state.logo;
|
||||
obj.configs[0].value[0].tuple[1].banner = state.banner;
|
||||
obj.configs[0].value[0].tuple[1].brandColor = state.brandColor;
|
||||
obj.configs[0].value[0].tuple[1].extensions.patron = state.patronEnabled;
|
||||
obj.configs[0].value[0].tuple[1].defaultSettings.autoPlayGif = state.autoPlayGif;
|
||||
obj.configs[0].value[0].tuple[1].copyright = state.copyright;
|
||||
this.state.homeFooterItems.forEach((f) =>
|
||||
obj.configs[0].value[0].tuple[1].navlinks.homeFooter.push({ title: f.get('title'), url: f.get('url') })
|
||||
);
|
||||
this.state.promoItems.forEach((f) =>
|
||||
obj.configs[0].value[0].tuple[1].promoPanel.items.push({ icon: f.get('icon'), text: f.get('text'), url: f.get('url') })
|
||||
);
|
||||
this.state.customCssItems.forEach((f) =>
|
||||
obj.configs[0].value[0].tuple[1].customCss.push(f)
|
||||
);
|
||||
return obj;
|
||||
}
|
||||
|
||||
handleSubmit = (event) => {
|
||||
|
|
|
@ -2,7 +2,6 @@ import {
|
|||
SOAPBOX_CONFIG_REQUEST_SUCCESS,
|
||||
SOAPBOX_CONFIG_REQUEST_FAIL,
|
||||
SOAPBOX_POST_SUCCESS,
|
||||
SOAPBOX_POST_REQUEST,
|
||||
} from '../actions/soapbox';
|
||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||
|
||||
|
@ -18,11 +17,8 @@ export default function soapbox(state = initialState, action) {
|
|||
return defaultState.merge(ImmutableMap(fromJS(action.soapboxConfig)));
|
||||
case SOAPBOX_CONFIG_REQUEST_FAIL:
|
||||
return defaultState;
|
||||
case SOAPBOX_POST_REQUEST:
|
||||
case SOAPBOX_POST_SUCCESS:
|
||||
// const soapbox = ImmutableMap(fromJS(action.soapboxConfig)).configs[0].value[0].tuple[1];
|
||||
// return soapbox;
|
||||
return defaultState;
|
||||
return defaultState.merge(ImmutableMap(fromJS(action.soapboxConfig.configs[0].value[0].tuple[1])));
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue