# Conflicts: # package.json # src/actions/pageActions.tsx # src/actions/widgetCardsPaneActions.tsx # src/api/Api.tsx # src/api/ApiRequests.tsx # src/api/ApiResponses.tsx # src/api/WidgetCardsPaneApi.tsx # src/constants/ActionConstants.tsx # src/constants/ApiConstants.tsx # src/normalizers/CanvasWidgetsNormalizer.tsx # src/reducers/entityReducers/canvasWidgetsReducer.tsx # src/reducers/entityReducers/index.tsx # src/reducers/entityReducers/widgetConfigReducer.tsx.tsx # src/reducers/index.tsx # src/reducers/uiReducers/canvasReducer.tsx # src/reducers/uiReducers/editorReducer.tsx # src/reducers/uiReducers/widgetCardsPaneReducer.tsx # src/sagas/PageSagas.tsx # src/sagas/WidgetCardsPaneSagas.tsx # src/sagas/index.tsx # src/utils/AppsmithUtils.tsx # src/widgets/AlertWidget.tsx # src/widgets/ButtonWidget.tsx # src/widgets/CheckboxWidget.tsx # src/widgets/DatePickerWidget.tsx # src/widgets/DropdownWidget.tsx # src/widgets/RadioGroupWidget.tsx # src/widgets/TableWidget.tsx
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { createReducer } from "../../utils/AppsmithUtils";
|
|
import {
|
|
ReduxActionTypes,
|
|
ReduxAction,
|
|
LoadCanvasWidgetsPayload,
|
|
LoadWidgetCardsPanePayload,
|
|
} from "../../constants/ReduxActionConstants";
|
|
import { WidgetCardProps, WidgetProps } from "../../widgets/BaseWidget";
|
|
import { ContainerWidgetProps } from "../../widgets/ContainerWidget";
|
|
|
|
const initialState: EditorReduxState = {};
|
|
|
|
const editorReducer = createReducer(initialState, {
|
|
[ReduxActionTypes.SUCCESS_FETCHING_WIDGET_CARDS]: (
|
|
state: EditorReduxState,
|
|
action: ReduxAction<LoadWidgetCardsPanePayload>,
|
|
) => {
|
|
return { ...state.pageWidget, ...action.payload };
|
|
},
|
|
[ReduxActionTypes.ADD_PAGE_WIDGET]: (
|
|
state: EditorReduxState,
|
|
action: ReduxAction<{ pageId: string; widget: WidgetProps }>,
|
|
) => {
|
|
return state;
|
|
},
|
|
[ReduxActionTypes.UPDATE_CANVAS]: (
|
|
state: EditorReduxState,
|
|
action: ReduxAction<LoadCanvasWidgetsPayload>,
|
|
) => {
|
|
return { pageWidgetId: action.payload.pageWidgetId };
|
|
},
|
|
});
|
|
|
|
export interface EditorReduxState {
|
|
pageWidget?: ContainerWidgetProps<any>;
|
|
cards?: {
|
|
[id: string]: WidgetCardProps[];
|
|
};
|
|
}
|
|
|
|
export default editorReducer;
|