Skip to content

Commit e69491f

Browse files
author
Filip Barl
authored
Merge pull request weaveworks#3617 from weaveworks/3611-fix-contrast-mode-in-url
Fixed contrast mode in the URL
2 parents f8c7196 + 765d9a0 commit e69491f

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

client/app/scripts/actions/app-actions.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -699,11 +699,12 @@ export function receiveNotFound(nodeId, requestTimestamp) {
699699
}
700700

701701
export function setContrastMode(enabled) {
702-
return (dispatch) => {
702+
return (dispatch, getState) => {
703703
dispatch({
704704
enabled,
705705
type: ActionTypes.TOGGLE_CONTRAST_MODE,
706706
});
707+
updateRoute(getState);
707708
};
708709
}
709710

client/app/scripts/components/footer.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,12 @@ import {
1313

1414

1515
class Footer extends React.Component {
16-
constructor(props, context) {
17-
super(props, context);
18-
19-
this.handleContrastClick = this.handleContrastClick.bind(this);
20-
this.handleRelayoutClick = this.handleRelayoutClick.bind(this);
21-
}
22-
23-
handleContrastClick(ev) {
16+
handleContrastClick = (ev) => {
2417
ev.preventDefault();
2518
this.props.setContrastMode(!this.props.contrastMode);
2619
}
2720

28-
handleRelayoutClick(ev) {
21+
handleRelayoutClick = (ev) => {
2922
ev.preventDefault();
3023
trackAnalyticsEvent('scope.layout.refresh.click', {
3124
layout: this.props.topologyViewMode,

client/app/scripts/reducers/root.js

+3
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,9 @@ export function rootReducer(state = initialState, action) {
692692
if (action.state.gridSortedDesc !== undefined) {
693693
state = state.set('gridSortedDesc', action.state.gridSortedDesc);
694694
}
695+
if (action.state.contrastMode !== undefined) {
696+
state = state.set('contrastMode', action.state.contrastMode);
697+
}
695698
if (action.state.showingNetworks) {
696699
state = state.set('showingNetworks', action.state.showingNetworks);
697700
}

0 commit comments

Comments
 (0)