2019-09-09 10:30:22 +00:00
|
|
|
import { createReducer } from "../../utils/AppsmithUtils";
|
2019-09-26 11:11:28 +00:00
|
|
|
import { getEditorConfigs } from "../../constants/ApiConstants";
|
2019-10-18 08:16:26 +00:00
|
|
|
import { ReduxActionTypes } from "../../constants/ReduxActionConstants";
|
|
|
|
|
import { WidgetProps } from "../../widgets/BaseWidget";
|
2019-09-09 10:30:22 +00:00
|
|
|
import { ContainerWidgetProps } from "../../widgets/ContainerWidget";
|
2019-09-27 16:05:33 +00:00
|
|
|
|
2019-09-26 11:11:28 +00:00
|
|
|
const editorConfigs = getEditorConfigs();
|
2019-09-17 15:09:55 +00:00
|
|
|
const initialState: EditorReduxState = {
|
|
|
|
|
pageWidgetId: "0",
|
2019-09-26 11:11:28 +00:00
|
|
|
...editorConfigs,
|
2019-09-23 10:27:45 +00:00
|
|
|
isSaving: false,
|
2019-09-17 15:09:55 +00:00
|
|
|
};
|
2019-08-26 12:41:21 +00:00
|
|
|
|
|
|
|
|
const editorReducer = createReducer(initialState, {
|
2019-09-23 10:27:45 +00:00
|
|
|
[ReduxActionTypes.SAVE_PAGE_INIT]: (state: EditorReduxState) => {
|
|
|
|
|
return { ...state, isSaving: true };
|
|
|
|
|
},
|
|
|
|
|
[ReduxActionTypes.SAVE_PAGE_SUCCESS]: (state: EditorReduxState) => {
|
|
|
|
|
return { ...state, isSaving: false };
|
|
|
|
|
},
|
2019-09-09 10:30:22 +00:00
|
|
|
});
|
2019-08-26 12:41:21 +00:00
|
|
|
|
|
|
|
|
export interface EditorReduxState {
|
2019-09-19 22:25:37 +00:00
|
|
|
dsl?: ContainerWidgetProps<WidgetProps>;
|
2019-09-17 15:09:55 +00:00
|
|
|
pageWidgetId: string;
|
2019-09-18 10:48:56 +00:00
|
|
|
currentPageId: string;
|
|
|
|
|
currentLayoutId: string;
|
2019-09-27 08:08:31 +00:00
|
|
|
currentPageName: string;
|
2019-10-21 11:40:24 +00:00
|
|
|
propertyPaneConfigsId: string;
|
2019-09-23 10:27:45 +00:00
|
|
|
isSaving: boolean;
|
2019-08-26 12:41:21 +00:00
|
|
|
}
|
|
|
|
|
|
2019-09-09 10:30:22 +00:00
|
|
|
export default editorReducer;
|