From 60dbda49e786b862f09c322091e1792a1a32a838 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Mon, 9 Sep 2024 16:25:50 +0530 Subject: [PATCH] chore: Transitions for IDE (#35714) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Uses `AnimatedGridLayout` component to introduce transitions for the IDE. This is behind a feature flag Fixes #34538 Fixes #30863 Fixes #34544 ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!CAUTION] > 🔴 🔴 🔴 Some tests have failed. > Workflow run: > Commit: a912f5c52366abe48768727a1c605cd72b48752c > Cypress dashboard. > Tags: @tag.All > Spec: > The following are new failures, please fix them before merging the PR:
    >
  1. cypress/e2e/Regression/ServerSide/OnLoadTests/ExecuteAction_Spec.ts
> List of identified flaky tests. >
Fri, 06 Sep 2024 16:32:30 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Introduced two new layout components: `AnimatedLayout` and `UnanimatedLayout` for improved editor interface structuring. - Added TypeScript type definitions for the DOM View Transitions API to enhance type safety and developer experience. - Implemented custom hooks, `useGridLayoutTemplate` and `useEditorStateLeftPaneWidth`, for dynamic grid management and left pane width calculation in the IDE layout. - **Improvements** - Enhanced layout responsiveness with the addition of dynamic grid management. - Updated the `Editor` component to use a centralized constant for height calculations, improving maintainability and consistency. - Enhanced test accuracy by refining assertions in the Git Branch Protection test suite. --------- Co-authored-by: Sagar Khalasi --- .../Git/GitSync/GitBranchProtect_spec.ts | 5 +- app/client/package.json | 1 + app/client/src/IDE/Structure/Header.tsx | 3 +- app/client/src/IDE/Structure/constants.ts | 1 + app/client/src/IDE/index.ts | 1 + app/client/src/ce/entities/FeatureFlag.ts | 2 + .../components/LayoutArea/LayoutArea.tsx | 2 +- .../AnimatedGridLayout/constants.ts | 6 +- .../src/components/BottomBar/components.ts | 3 +- .../src/components/BottomBar/constants.ts | 1 + app/client/src/components/BottomBar/index.tsx | 16 +- .../editorComponents/PropertyPaneSidebar.tsx | 92 ++-------- .../common/modalOverlay/ModalOverlayLayer.tsx | 4 +- .../src/pages/AdminSettings/components.tsx | 3 +- .../pages/AppViewer/Navigation/Sidebar.tsx | 8 +- app/client/src/pages/Editor/Canvas.tsx | 2 +- .../src/pages/Editor/EditorName/components.ts | 7 +- .../Explorer/Entity/EntityProperties.tsx | 6 +- .../pages/Editor/IDE/EditorPane/Editor.tsx | 12 +- .../src/pages/Editor/IDE/EditorPane/index.tsx | 4 +- .../IDE/EditorTabs/ScreenModeToggle.tsx | 32 +++- .../Editor/IDE/Layout/AnimatedLayout.tsx | 51 ++++++ .../Editor/IDE/Layout/UnanimatedLayout.tsx | 67 +++++++ .../src/pages/Editor/IDE/Layout/constants.ts | 15 ++ .../hooks/useEditorStateLeftPaneWidth.ts | 49 ++++++ .../IDE/Layout/hooks/useGridLayoutTemplate.ts | 164 ++++++++++++++++++ .../src/pages/Editor/IDE/Layout/index.ts | 2 + .../Editor/IDE/LeftPane/DataSidePane.tsx | 2 +- .../Editor/IDE/LeftPane/LibrarySidePane.tsx | 3 +- .../src/pages/Editor/IDE/LeftPane/index.tsx | 1 + .../src/pages/Editor/IDE/MainPane/index.tsx | 2 +- .../Editor/IDE/ProtectedCallout.test.tsx | 4 + .../src/pages/Editor/IDE/ProtectedCallout.tsx | 4 +- app/client/src/pages/Editor/IDE/hooks.ts | 35 ---- app/client/src/pages/Editor/IDE/index.tsx | 65 ++----- .../pages/Editor/JSEditor/styledComponents.ts | 3 +- .../Editor/PropertyPane/PropertyPaneTitle.tsx | 9 +- .../WidgetsEditor/WidgetEditorContainer.tsx | 11 +- .../components/PropertyPaneWrapper.tsx | 30 +--- .../Editor/commons/EditorHeaderComponents.tsx | 3 +- .../commons/EditorSettingsPaneContainer.tsx | 3 +- .../Editor/commons/EditorWrapperContainer.tsx | 9 +- .../src/pages/Editor/commons/Omnibar.tsx | 3 +- .../gitSync/components/GitErrorPopup.tsx | 3 +- app/client/src/pages/Editor/index.tsx | 3 +- app/client/yarn.lock | 8 + 46 files changed, 517 insertions(+), 243 deletions(-) create mode 100644 app/client/src/IDE/Structure/constants.ts create mode 100644 app/client/src/components/BottomBar/constants.ts create mode 100644 app/client/src/pages/Editor/IDE/Layout/AnimatedLayout.tsx create mode 100644 app/client/src/pages/Editor/IDE/Layout/UnanimatedLayout.tsx create mode 100644 app/client/src/pages/Editor/IDE/Layout/constants.ts create mode 100644 app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts create mode 100644 app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts create mode 100644 app/client/src/pages/Editor/IDE/Layout/index.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts index 92c3858ea3e..6a27f57bb7b 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts @@ -36,10 +36,7 @@ describe("Git Branch Protection", { tags: ["@tag.Git"] }, function () { cy.wait("@gitProtectApi").then((res1) => { _.agHelper.GetNClick(_.gitSync._closeGitSettingsModal); expect(res1.response).to.have.property("statusCode", 200); - _.agHelper.AssertElementVisibility( - AppSidebar.locators.sidebar, - false, - ); + _.agHelper.AssertElementAbsence(AppSidebar.locators.sidebar); _.agHelper.AssertElementVisibility( PageLeftPane.locators.selector, false, diff --git a/app/client/package.json b/app/client/package.json index cf1766d99b6..592cf597a37 100644 --- a/app/client/package.json +++ b/app/client/package.json @@ -269,6 +269,7 @@ "@types/codemirror": "^0.0.96", "@types/deep-diff": "^1.0.0", "@types/dom-mediacapture-record": "^1.0.11", + "@types/dom-view-transitions": "^1.0.5", "@types/downloadjs": "^1.4.2", "@types/jest": "^27.4.1", "@types/js-beautify": "^1.13.2", diff --git a/app/client/src/IDE/Structure/Header.tsx b/app/client/src/IDE/Structure/Header.tsx index 53de646437b..14e8917a956 100644 --- a/app/client/src/IDE/Structure/Header.tsx +++ b/app/client/src/IDE/Structure/Header.tsx @@ -1,6 +1,7 @@ import React from "react"; import { Divider, Flex } from "@appsmith/ads"; import { AppsmithLink } from "pages/Editor/AppsmithLink"; +import { IDE_HEADER_HEIGHT } from "./constants"; interface ChildrenProps { children: React.ReactNode | React.ReactNode[]; @@ -59,7 +60,7 @@ const Header = (props: ChildrenProps) => { alignItems="center" border="1px solid var(--ads-v2-color-border)" className="t--editor-header" - height="40px" + height={IDE_HEADER_HEIGHT + "px"} overflow="hidden" width="100%" > diff --git a/app/client/src/IDE/Structure/constants.ts b/app/client/src/IDE/Structure/constants.ts new file mode 100644 index 00000000000..2690fc4609d --- /dev/null +++ b/app/client/src/IDE/Structure/constants.ts @@ -0,0 +1 @@ +export const IDE_HEADER_HEIGHT = 40; diff --git a/app/client/src/IDE/index.ts b/app/client/src/IDE/index.ts index 0b765da22ce..8a12a855b8e 100644 --- a/app/client/src/IDE/index.ts +++ b/app/client/src/IDE/index.ts @@ -9,6 +9,7 @@ * These are composable components that you can use to spread the content of the header * It is possible to use the IDE Header without using these subsections */ +export { IDE_HEADER_HEIGHT } from "./Structure/constants"; export { default as IDEHeader } from "./Structure/Header"; /* ==================================================== diff --git a/app/client/src/ce/entities/FeatureFlag.ts b/app/client/src/ce/entities/FeatureFlag.ts index 6deb49556d8..69ac4b7e9c6 100644 --- a/app/client/src/ce/entities/FeatureFlag.ts +++ b/app/client/src/ce/entities/FeatureFlag.ts @@ -45,6 +45,7 @@ export const FEATURE_FLAG = { "ab_learnability_discoverability_collapse_all_except_data_enabled", release_layout_conversion_enabled: "release_layout_conversion_enabled", release_anvil_toggle_enabled: "release_anvil_toggle_enabled", + release_ide_animations_enabled: "release_ide_animations_enabled", } as const; export type FeatureFlag = keyof typeof FEATURE_FLAG; @@ -82,6 +83,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = { ab_learnability_discoverability_collapse_all_except_data_enabled: true, release_layout_conversion_enabled: false, release_anvil_toggle_enabled: false, + release_ide_animations_enabled: false, }; export const AB_TESTING_EVENT_KEYS = { diff --git a/app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx b/app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx index bbf8d0da44e..f646eef0302 100644 --- a/app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx +++ b/app/client/src/components/AnimatedGridLayout/components/LayoutArea/LayoutArea.tsx @@ -41,7 +41,7 @@ export function LayoutArea(props: LayoutAreaProps) { >
props.theme.bottomBarHeight}; + height: ${BOTTOM_BAR_HEIGHT}px; display: flex; position: fixed; justify-content: space-between; diff --git a/app/client/src/components/BottomBar/constants.ts b/app/client/src/components/BottomBar/constants.ts new file mode 100644 index 00000000000..9a46200fb9d --- /dev/null +++ b/app/client/src/components/BottomBar/constants.ts @@ -0,0 +1 @@ +export const BOTTOM_BAR_HEIGHT = 37; diff --git a/app/client/src/components/BottomBar/index.tsx b/app/client/src/components/BottomBar/index.tsx index 1c358dc6ec8..c40dbca3fc3 100644 --- a/app/client/src/components/BottomBar/index.tsx +++ b/app/client/src/components/BottomBar/index.tsx @@ -7,14 +7,18 @@ import { Button } from "@appsmith/ads"; import SwitchEnvironment from "ee/components/SwitchEnvironment"; import { Container, Wrapper } from "./components"; import { useSelector } from "react-redux"; -import { getCurrentApplicationId } from "selectors/editorSelectors"; +import { + getCurrentApplicationId, + previewModeSelector, +} from "selectors/editorSelectors"; import { useDispatch } from "react-redux"; import { softRefreshActions } from "actions/pluginActionActions"; import { START_SWITCH_ENVIRONMENT } from "ee/constants/messages"; import { getIsAnvilEnabledInCurrentApplication } from "layoutSystems/anvil/integrations/selectors"; -export default function BottomBar({ viewMode }: { viewMode: boolean }) { +export default function BottomBar() { const appId = useSelector(getCurrentApplicationId) || ""; + const isPreviewMode = useSelector(previewModeSelector); const dispatch = useDispatch(); // We check if the current application is an Anvil application. // If it is an Anvil application, we remove the Git features from the bottomBar @@ -28,17 +32,17 @@ export default function BottomBar({ viewMode }: { viewMode: boolean }) { return ( - {!viewMode && ( + {!isPreviewMode && ( )} - {!viewMode && !isAnvilEnabled && } + {!isPreviewMode && !isAnvilEnabled && } - {!viewMode && ( + {!isPreviewMode && (