import * as mainActions from './main'; import * as pdfActions from './pdf'; import * as searchActions from './search'; import * as types from '../constants/actionTypes'; import { StateType } from '../store'; const createReducer = (handlers: Record) => ( state: StateType, action: DispatchObjType, // eslint-disable-next-line @typescript-eslint/no-explicit-any ): 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_QUERY_STRING]: searchActions.setQueryString, [types.SET_CURRENT_INDEX]: searchActions.setCurrentIndex, [types.SET_MATCHES_MAP]: searchActions.setMatchesMap, });