PromucFlow_constructor/app/client/src/actions/autoLayoutActions.ts
Nilansh Bansal 9be87c2cc2
feat: added anvil type for app layout (#27633)
## Description
This PR adds a new type ANVIL in the acceptable app layout types.
In this PR, 
BE changes: 
- Anvil type is added to appPositioiningType enum.

FE changes:
- rename appPositioningType to layoutSystemType internally in all places
except the reducer and application payload.
- move certain layout system specific files into layout system folder

#### PR fixes following issue(s)
Fixes #26973 

#### Type of change
- New feature (non-breaking change which adds functionality)

## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

---------

Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
2023-10-04 14:24:16 +05:30

106 lines
2.5 KiB
TypeScript

import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import type { LayoutSystemTypes } from "layoutSystems/types";
import type { CanvasWidgetsReduxState } from "reducers/entityReducers/canvasWidgetsReducer";
import type {
CONVERSION_STATES,
SnapShotDetails,
} from "reducers/uiReducers/layoutConversionReducer";
/**
* Calculate size and position changes owing to minSizes and flex wrap.
* This function is triggered the first time mobile viewport (480px) is encountered.
* It is also called when increasing viewport size from mobile to desktop.
*/
export const updateLayoutForMobileBreakpointAction = (
parentId: string,
isMobile: boolean,
canvasWidth: number,
widgets?: CanvasWidgetsReduxState,
) => {
return {
type: ReduxActionTypes.RECALCULATE_COLUMNS,
payload: {
parentId,
isMobile,
canvasWidth,
widgets,
},
};
};
export const updateLayoutSystemType = (layoutSystemType: LayoutSystemTypes) => {
return {
type: ReduxActionTypes.UPDATE_LAYOUT_SYSTEM_TYPE,
payload: layoutSystemType,
};
};
export const setLayoutConversionStateAction = (
conversionState: CONVERSION_STATES,
error?: Error,
) => {
return {
type: ReduxActionTypes.SET_LAYOUT_CONVERSION_STATE,
payload: { conversionState, error },
};
};
export const updateSnapshotDetails = (
snapShotDetails: SnapShotDetails | undefined,
) => {
return {
type: ReduxActionTypes.UPDATE_SNAPSHOT_DETAILS,
payload: snapShotDetails,
};
};
export function updateWidgetDimensionAction(
widgetId: string,
width: number,
height: number,
) {
return {
type: ReduxActionTypes.UPDATE_WIDGET_DIMENSIONS,
payload: {
widgetId,
width,
height,
},
};
}
export const fetchSnapshotDetailsAction = () => {
return {
type: ReduxActionTypes.FETCH_LAYOUT_SNAPSHOT_DETAILS,
};
};
export const setConversionStart = (conversionState: CONVERSION_STATES) => {
return {
type: ReduxActionTypes.START_CONVERSION_FLOW,
payload: conversionState,
};
};
export const setConversionStop = () => {
return {
type: ReduxActionTypes.STOP_CONVERSION_FLOW,
};
};
export const setAutoCanvasResizing = (isAutoCanvasResizing: boolean) => {
return {
type: ReduxActionTypes.SET_AUTO_CANVAS_RESIZING,
payload: isAutoCanvasResizing,
};
};
export const updatePositionsOnTabChange = (
widgetId: string,
selectedTabWidgetId: string,
) => {
return {
type: ReduxActionTypes.UPDATE_POSITIONS_ON_TAB_CHANGE,
payload: { selectedTabWidgetId, widgetId },
};
};