2022-04-12 10:50:01 +00:00
|
|
|
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
2023-08-01 04:02:41 +00:00
|
|
|
import type { EntityInfo } from "pages/Editor/EntityNavigation/types";
|
2021-11-23 08:01:46 +00:00
|
|
|
|
2023-01-09 14:22:23 +00:00
|
|
|
/**
|
|
|
|
|
* init action that sets preview mode. navigates to canvas when payload is true
|
|
|
|
|
* navigates back when the payload is false i.e when switched to edit mode
|
|
|
|
|
*
|
|
|
|
|
* @param payload
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
export const setPreviewModeInitAction = (payload: boolean) => ({
|
|
|
|
|
type: ReduxActionTypes.SET_PREVIEW_MODE_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
2021-11-23 08:01:46 +00:00
|
|
|
/**
|
|
|
|
|
* action that sets preview mode
|
|
|
|
|
*
|
|
|
|
|
* @param payload
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
export const setPreviewModeAction = (payload: boolean) => ({
|
|
|
|
|
type: ReduxActionTypes.SET_PREVIEW_MODE,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
2022-11-02 09:09:59 +00:00
|
|
|
/**
|
|
|
|
|
* action that sets visibility state of the canvas top section
|
|
|
|
|
*
|
|
|
|
|
* @param payload
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
export const setCanvasCardsState = (payload: string) => ({
|
|
|
|
|
type: ReduxActionTypes.SET_CANVAS_CARDS_STATE,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
/**
|
|
|
|
|
* action that deletes/clears the visibility state of the canvas top section
|
|
|
|
|
*
|
|
|
|
|
* @param payload
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
export const deleteCanvasCardsState = () => ({
|
|
|
|
|
type: ReduxActionTypes.DELETE_CANVAS_CARDS_STATE,
|
|
|
|
|
});
|
|
|
|
|
|
2021-11-23 08:01:46 +00:00
|
|
|
/**
|
|
|
|
|
* action that update canvas layout
|
|
|
|
|
*
|
|
|
|
|
* @param width
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
2023-05-31 13:06:34 +00:00
|
|
|
export const updateCanvasLayoutAction = (width: number) => {
|
2021-11-23 08:01:46 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_CANVAS_LAYOUT,
|
|
|
|
|
payload: {
|
|
|
|
|
width,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
2021-12-24 13:59:02 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This action when executed updates the status of saving entity to true
|
|
|
|
|
* This function was created to add a sync to the entity update and shortcut command being fired to execute any command.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-11-15 06:20:18 +00:00
|
|
|
export const startingEntityUpdate = () => ({
|
2021-12-24 13:59:02 +00:00
|
|
|
type: ReduxActionTypes.ENTITY_UPDATE_STARTED,
|
|
|
|
|
});
|
2023-08-01 04:02:41 +00:00
|
|
|
|
|
|
|
|
export const navigateToEntity = (payload: EntityInfo) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.NAVIGATE_TO_ENTITY,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|