pagraphcontrol/reducers/preferences.js
2018-11-19 21:24:16 +03:00

40 lines
843 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,
hideMonitorSourceEdges: false,
hideMonitors: false,
hidePulseaudioApps: true,
hideVolumeThumbnails: false,
lockChannelsTogether: true,
maxVolume: 1.5,
volumeStep: 1 / 20,
doNotAskForConfirmations: 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,
};