Postpone setting the brand color until soapbox.json succeeds or fails
Fixes color flickering during load
This commit is contained in:
parent
8f566b70e6
commit
3e2b282cb8
2 changed files with 12 additions and 3 deletions
|
@ -48,7 +48,7 @@ const mapStateToProps = (state) => {
|
||||||
dyslexicFont: settings.get('dyslexicFont'),
|
dyslexicFont: settings.get('dyslexicFont'),
|
||||||
demetricator: settings.get('demetricator'),
|
demetricator: settings.get('demetricator'),
|
||||||
locale: settings.get('locale'),
|
locale: settings.get('locale'),
|
||||||
themeCss: generateThemeCss(state.getIn(['soapbox', 'brandColor'], '#0482d8')), // Azure default
|
themeCss: generateThemeCss(state.getIn(['soapbox', 'brandColor'])),
|
||||||
themeMode: settings.get('themeMode'),
|
themeMode: settings.get('themeMode'),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
import { SOAPBOX_CONFIG_REQUEST_SUCCESS } from '../actions/soapbox';
|
import {
|
||||||
|
SOAPBOX_CONFIG_REQUEST_SUCCESS,
|
||||||
|
SOAPBOX_CONFIG_REQUEST_FAIL,
|
||||||
|
} from '../actions/soapbox';
|
||||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
|
|
||||||
const initialState = ImmutableMap();
|
const initialState = ImmutableMap();
|
||||||
|
|
||||||
|
const defaultState = ImmutableMap({
|
||||||
|
brandColor: '#0482d8', // Azure
|
||||||
|
});
|
||||||
|
|
||||||
export default function soapbox(state = initialState, action) {
|
export default function soapbox(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case SOAPBOX_CONFIG_REQUEST_SUCCESS:
|
case SOAPBOX_CONFIG_REQUEST_SUCCESS:
|
||||||
return ImmutableMap(fromJS(action.soapboxConfig));
|
return defaultState.merge(ImmutableMap(fromJS(action.soapboxConfig)));
|
||||||
|
case SOAPBOX_CONFIG_REQUEST_FAIL:
|
||||||
|
return defaultState;
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue