12345678910111213141516171819202122232425262728293031323334353637383940 |
- import * as mainActions from './main';
- import * as pdfActions from './pdf';
- import * as searchActions from './search';
- import * as types from '../constants/actionTypes';
- const createReducer = (handlers: { [key: string]: any }) => (
- state: Record<string, any>,
- action: { type: string }
- ): any => {
- if (!Object.prototype.hasOwnProperty.call(handlers, action.type)) {
- return state;
- }
- return handlers[action.type](state, action);
- };
- export default createReducer({
- [types.TOGGLE_DISPLAY_MODE]: mainActions.toggleDisplayMode,
- [types.SET_NAVBAR]: mainActions.setNavbarState,
- [types.SET_SIDEBAR]: mainActions.setSidebarState,
- [types.SET_TOOL]: mainActions.setTool,
- [types.SET_INFO]: mainActions.setInfo,
- [types.SET_LOADING]: mainActions.setLoading,
- [types.SET_CURRENT_PAGE]: pdfActions.setCurrentPage,
- [types.SET_TOTAL_PAGE]: pdfActions.setTotalPage,
- [types.SET_PDF]: pdfActions.setPdf,
- [types.SET_PROGRESS]: pdfActions.setProgress,
- [types.SET_VIEWPORT]: pdfActions.setViewport,
- [types.CHANGE_SCALE]: pdfActions.changeScale,
- [types.CHANGE_ROTATE]: pdfActions.changeRotate,
- [types.ADD_ANNOTS]: pdfActions.addAnnotation,
- [types.UPDATE_ANNOTS]: pdfActions.updateAnnotation,
- [types.UPDATE_WATERMARK]: pdfActions.updateWatermark,
- [types.SET_TEXT_DIV]: pdfActions.setTextDivs,
- [types.SET_QUERY_STRING]: searchActions.setQueryString,
- [types.SET_CURRENT_INDEX]: searchActions.setCurrentIndex,
- [types.SET_MATCHES_MAP]: searchActions.setMatchesMap,
- });
|