PromucFlow_constructor/app/client/src/reducers/uiReducers/reflowReducer.ts
2022-08-04 11:10:44 +05:30

34 lines
797 B
TypeScript

import { createReducer } from "utils/ReducerUtils";
import {
ReduxAction,
ReflowReduxActionTypes,
} from "@appsmith/constants/ReduxActionConstants";
import { ReflowedSpaceMap } from "reflow/reflowTypes";
const initialState: widgetReflow = {
isReflowing: false,
reflowingWidgets: {},
};
export const widgetReflowReducer = createReducer(initialState, {
[ReflowReduxActionTypes.STOP_REFLOW]: () => {
return {
isReflowing: false,
};
},
[ReflowReduxActionTypes.REFLOW_MOVE]: (
state: widgetReflow,
action: ReduxAction<{ reflowingWidgets: ReflowedSpaceMap }>,
) => {
return {
isReflowing: true,
reflowingWidgets: { ...action.payload },
};
},
});
export type widgetReflow = {
isReflowing: boolean;
reflowingWidgets: ReflowedSpaceMap;
};