PromucFlow_constructor/app/client/src/reducers/uiReducers/mainCanvasReducer.ts

47 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-08-04 05:40:44 +00:00
import { createImmerReducer } from "utils/ReducerUtils";
import {
ReduxAction,
ReduxActionTypes,
UpdateCanvasPayload,
} from "@appsmith/constants/ReduxActionConstants";
import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";
import { UpdateCanvasLayoutPayload } from "actions/controlActions";
const initialState: MainCanvasReduxState = {
initialized: false,
width: 0,
height: 0,
feat: Multi Pane IDE: Phase 1 (#19261) ## Description Starts work on the Multi Pane IDE that would be behind a feature flag right now. We will continue work on this behind the scenes > New shiny Multi Pane layout that will be unwrapped after a few months Fixes #19210 ## Type of change - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) ## How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Provide instructions, so we can reproduce. > Please also list any relevant details for your test configuration. > Delete anything that is not important - Manual - 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 - [ ] My code follows the style guidelines of this project - [ ] 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 - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-09 05:24:41 +00:00
scale: 1,
};
const mainCanvasReducer = createImmerReducer(initialState, {
[ReduxActionTypes.INIT_CANVAS_LAYOUT]: (
state: MainCanvasReduxState,
action: ReduxAction<UpdateCanvasPayload>,
) => {
const mainCanvas =
action.payload.widgets &&
action.payload.widgets[MAIN_CONTAINER_WIDGET_ID];
state.width = mainCanvas?.rightColumn || state.width;
state.height = mainCanvas?.minHeight || state.height;
},
[ReduxActionTypes.UPDATE_CANVAS_LAYOUT]: (
state: MainCanvasReduxState,
action: ReduxAction<UpdateCanvasLayoutPayload>,
) => {
state.width = action.payload.width || state.width;
feat: Multi Pane IDE: Phase 1 (#19261) ## Description Starts work on the Multi Pane IDE that would be behind a feature flag right now. We will continue work on this behind the scenes > New shiny Multi Pane layout that will be unwrapped after a few months Fixes #19210 ## Type of change - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) ## How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Provide instructions, so we can reproduce. > Please also list any relevant details for your test configuration. > Delete anything that is not important - Manual - 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 - [ ] My code follows the style guidelines of this project - [ ] 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 - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-09 05:24:41 +00:00
state.scale = action.payload.scale;
state.initialized = true;
},
});
export interface MainCanvasReduxState {
feat: Multi Pane IDE: Phase 1 (#19261) ## Description Starts work on the Multi Pane IDE that would be behind a feature flag right now. We will continue work on this behind the scenes > New shiny Multi Pane layout that will be unwrapped after a few months Fixes #19210 ## Type of change - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) ## How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Provide instructions, so we can reproduce. > Please also list any relevant details for your test configuration. > Delete anything that is not important - Manual - 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 - [ ] My code follows the style guidelines of this project - [ ] 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 - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-09 05:24:41 +00:00
initialized: boolean;
width: number;
height: number;
feat: Multi Pane IDE: Phase 1 (#19261) ## Description Starts work on the Multi Pane IDE that would be behind a feature flag right now. We will continue work on this behind the scenes > New shiny Multi Pane layout that will be unwrapped after a few months Fixes #19210 ## Type of change - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) ## How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Provide instructions, so we can reproduce. > Please also list any relevant details for your test configuration. > Delete anything that is not important - Manual - 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 - [ ] My code follows the style guidelines of this project - [ ] 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 - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-09 05:24:41 +00:00
scale: number;
}
export default mainCanvasReducer;