2016-06-22 21:58:23 +02:00
|
|
|
import * as ActionTypes from '../../../constants';
|
2016-06-17 19:37:29 +02:00
|
|
|
|
|
|
|
const initialState = {
|
2016-07-06 17:27:39 +02:00
|
|
|
fontSize: 18,
|
2016-07-11 15:00:44 +02:00
|
|
|
indentationAmount: 2,
|
2016-08-09 20:20:54 +02:00
|
|
|
isTabIndent: true,
|
|
|
|
autosave: true
|
2016-06-24 00:29:55 +02:00
|
|
|
};
|
2016-06-17 19:37:29 +02:00
|
|
|
|
|
|
|
const preferences = (state = initialState, action) => {
|
2016-06-24 00:29:55 +02:00
|
|
|
switch (action.type) {
|
2016-08-04 05:45:49 +02:00
|
|
|
case ActionTypes.SET_FONT_SIZE:
|
|
|
|
return Object.assign({}, state, { fontSize: action.value });
|
|
|
|
case ActionTypes.SET_INDENTATION:
|
|
|
|
return Object.assign({}, state, { indentationAmount: action.value });
|
2016-07-11 04:52:48 +02:00
|
|
|
case ActionTypes.INDENT_WITH_TAB:
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
isTabIndent: true
|
|
|
|
});
|
|
|
|
case ActionTypes.INDENT_WITH_SPACE:
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
isTabIndent: false
|
|
|
|
});
|
2016-08-09 22:15:28 +02:00
|
|
|
case ActionTypes.SET_AUTOSAVE:
|
|
|
|
return Object.assign({}, state, { autosave: action.value });
|
2016-08-09 23:50:45 +02:00
|
|
|
case ActionTypes.SET_PREFERENCES:
|
|
|
|
return action.preferences;
|
2016-06-24 00:29:55 +02:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
2016-06-17 19:37:29 +02:00
|
|
|
|
2016-06-24 00:29:55 +02:00
|
|
|
export default preferences;
|