pagraphcontrol/reducers/preferences.js
2018-11-08 20:39:54 +03:00

28 lines
627 B
JavaScript

const {
merge,
} = require('ramda');
const { handleActions } = require('redux-actions');
const { preferences } = require('../actions');
const initialState = {
hideDisconnectedClients: true,
hideDisconnectedModules: true,
hideDisconnectedSources: false,
hideDisconnectedSinks: false,
showDebugInfo: false,
};
const reducer = handleActions({
[preferences.set]: (state, { payload }) => merge(state, payload),
[preferences.toggle]: (state, { payload }) => merge(state, { [payload]: !state[payload] }),
[preferences.resetDefaults]: () => initialState,
}, initialState);
module.exports = {
initialState,
reducer,
};