2018-02-26 16:14:46 +00:00
|
|
|
// @flow
|
2018-02-02 14:50:16 +00:00
|
|
|
|
2018-06-11 17:28:45 +00:00
|
|
|
import { ReducerRegistry, set } from '../base/redux';
|
2018-06-05 12:34:40 +00:00
|
|
|
import { PersistenceRegistry } from '../base/storage';
|
2018-06-11 17:28:45 +00:00
|
|
|
|
2018-06-05 12:34:40 +00:00
|
|
|
import {
|
|
|
|
SET_SIDEBAR_VISIBLE,
|
2018-06-11 17:28:45 +00:00
|
|
|
SET_WELCOME_PAGE_LISTS_DEFAULT_PAGE
|
2018-06-05 12:34:40 +00:00
|
|
|
} from './actionTypes';
|
|
|
|
|
|
|
|
/**
|
2018-06-11 17:28:45 +00:00
|
|
|
* The name of the redux store/state property which is the root of the redux
|
|
|
|
* state of the feature {@code welcome}.
|
2018-06-05 12:34:40 +00:00
|
|
|
*/
|
|
|
|
const STORE_NAME = 'features/welcome';
|
|
|
|
|
|
|
|
/**
|
2018-06-11 17:28:45 +00:00
|
|
|
* Sets up the persistence of the feature {@code welcome}.
|
2018-06-05 12:34:40 +00:00
|
|
|
*/
|
|
|
|
PersistenceRegistry.register(STORE_NAME, {
|
|
|
|
defaultPage: true
|
|
|
|
});
|
2018-02-02 14:50:16 +00:00
|
|
|
|
|
|
|
/**
|
2018-06-11 17:28:45 +00:00
|
|
|
* Reduces redux actions for the purposes of the feature {@code welcome}.
|
2018-02-02 14:50:16 +00:00
|
|
|
*/
|
2018-06-05 12:34:40 +00:00
|
|
|
ReducerRegistry.register(STORE_NAME, (state = {}, action) => {
|
2018-02-26 16:14:46 +00:00
|
|
|
switch (action.type) {
|
|
|
|
case SET_SIDEBAR_VISIBLE:
|
2018-06-11 17:28:45 +00:00
|
|
|
return set(state, 'sideBarVisible', action.visible);
|
2018-06-05 12:34:40 +00:00
|
|
|
|
2018-06-11 17:28:45 +00:00
|
|
|
case SET_WELCOME_PAGE_LISTS_DEFAULT_PAGE:
|
|
|
|
return set(state, 'defaultPage', action.pageIndex);
|
2018-02-26 16:14:46 +00:00
|
|
|
}
|
2018-06-11 17:28:45 +00:00
|
|
|
|
|
|
|
return state;
|
2018-02-26 16:14:46 +00:00
|
|
|
});
|