Skip to content

chore: Transitions for IDE#35714

Merged
hetunandu merged 24 commits intoreleasefrom
feat/app-ide-transitions
Sep 9, 2024
Merged

chore: Transitions for IDE#35714
hetunandu merged 24 commits intoreleasefrom
feat/app-ide-transitions

Conversation

@hetunandu
Copy link
Member

@hetunandu hetunandu commented Aug 15, 2024

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"

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10737363879
Commit: a912f5c
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 15, 2024

Walkthrough

This update introduces a comprehensive layout system for the Integrated Development Environment (IDE), featuring both animated and unanimated layouts to enhance rendering flexibility. A custom React hook for managing grid layouts improves responsiveness, while TypeScript type definitions for the DOM View Transitions API enhance type safety within the project. Additionally, the Editor component's height calculation has been made more dynamic by utilizing a centralized constant.

Changes

Files Changed Change Summary
app/client/package.json Added dependency for TypeScript type definitions of the DOM View Transitions API, enhancing type safety.
app/client/src/pages/Editor/IDE/Layout/AnimatedLayout.tsx, app/client/src/pages/Editor/IDE/Layout/UnanimatedLayout.tsx Introduced AnimatedLayout and UnanimatedLayout, which simplify layout management based on rendering strategies.
app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts Added a custom hook useGridLayoutTemplate to dynamically manage grid dimensions for responsive layouts.
app/client/src/pages/Editor/index.tsx Updated height calculation in CenteredWrapper to use IDE_HEADER_HEIGHT for improved maintainability and consistency.
app/client/src/pages/Editor/IDE/ProtectedCallout.test.tsx Enhanced getMockStore function to utilize initial state from the imported store for more accurate testing representation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant AnimatedLayout
    participant UnanimatedLayout

    User->>App: Toggle animation feature
    App->>AnimatedLayout: Render components with animations
    App->>UnanimatedLayout: Render components without animations
Loading

Assessment against linked issues

Objective Addressed Explanation
Create layout for IDE ( #34538 )
Add transitions for Side by Side ( #30863 ) The changes do not specify particular transition updates for side-by-side functionalities.

🎉 In the realm of code where changes arise,
A layout emerges, a visual surprise.
Constants now rule, with heights that align,
Creating a canvas where all can combine.
Animations beckon, making interfaces bright,
In this world of coding, everything feels right! 🌈


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the Enhancement New feature or request label Aug 15, 2024
@hetunandu hetunandu changed the title feat: Transitions for IDE chore: Transitions for IDE Aug 15, 2024
@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Enhancement New feature or request IDE Navigation Issues/feature requests related to IDE navigation, and context switching IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Task A simple Todo and removed Enhancement New feature or request skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Aug 15, 2024
@hetunandu hetunandu added Enhancement New feature or request ok-to-test Required label for CI and removed skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Aug 15, 2024
@hetunandu hetunandu marked this pull request as ready for review August 15, 2024 11:36
@hetunandu hetunandu requested review from a team, KelvinOm and ayushpahwa as code owners August 15, 2024 11:36
@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog and removed Enhancement New feature or request labels Aug 15, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (1)
app/client/src/pages/Editor/IDE/EditorPane/index.tsx (1)

Line range hint 19-19:
Address the @ts-expect-error comment.

The presence of @ts-expect-error suggests a known type issue. It's important to resolve this to maintain type safety and code quality. Consider addressing this the next time the file is edited.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ee9cd3b and 7c12d18.

Files ignored due to path filters (1)
  • app/client/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (42)
  • app/client/package.json (1 hunks)
  • app/client/src/IDE/Structure/Header.tsx (2 hunks)
  • app/client/src/IDE/Structure/constants.ts (1 hunks)
  • app/client/src/IDE/index.ts (1 hunks)
  • app/client/src/ce/entities/FeatureFlag.ts (2 hunks)
  • app/client/src/components/AnimatedGridLayout/constants.ts (1 hunks)
  • app/client/src/components/BottomBar/components.ts (1 hunks)
  • app/client/src/components/BottomBar/constants.ts (1 hunks)
  • app/client/src/components/BottomBar/index.tsx (2 hunks)
  • app/client/src/components/editorComponents/PropertyPaneSidebar.tsx (4 hunks)
  • app/client/src/layoutSystems/common/modalOverlay/ModalOverlayLayer.tsx (3 hunks)
  • app/client/src/pages/AdminSettings/components.tsx (2 hunks)
  • app/client/src/pages/AppViewer/Navigation/Sidebar.tsx (3 hunks)
  • app/client/src/pages/Editor/Canvas.tsx (1 hunks)
  • app/client/src/pages/Editor/EditorName/components.ts (3 hunks)
  • app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Editor.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/index.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorTabs/ScreenModeToggle.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/Layout/AnimatedLayout.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/Layout/UnanimatedLayout.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/Layout/constants.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/Layout/index.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/LeftPane/DataSidePane.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/LeftPane/LibrarySidePane.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/LeftPane/index.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/MainPane/index.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/ProtectedCallout.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/hooks.ts (4 hunks)
  • app/client/src/pages/Editor/IDE/index.tsx (1 hunks)
  • app/client/src/pages/Editor/JSEditor/styledComponents.ts (2 hunks)
  • app/client/src/pages/Editor/PropertyPane/PropertyPaneTitle.tsx (3 hunks)
  • app/client/src/pages/Editor/WidgetsEditor/WidgetEditorContainer.tsx (3 hunks)
  • app/client/src/pages/Editor/WidgetsEditor/components/PropertyPaneWrapper.tsx (2 hunks)
  • app/client/src/pages/Editor/commons/EditorHeaderComponents.tsx (2 hunks)
  • app/client/src/pages/Editor/commons/EditorSettingsPaneContainer.tsx (2 hunks)
  • app/client/src/pages/Editor/commons/EditorWrapperContainer.tsx (2 hunks)
  • app/client/src/pages/Editor/commons/Omnibar.tsx (1 hunks)
  • app/client/src/pages/Editor/gitSync/components/GitErrorPopup.tsx (2 hunks)
  • app/client/src/pages/Editor/index.tsx (2 hunks)
Files skipped from review due to trivial changes (9)
  • app/client/package.json
  • app/client/src/IDE/Structure/constants.ts
  • app/client/src/IDE/index.ts
  • app/client/src/components/BottomBar/constants.ts
  • app/client/src/pages/Editor/Explorer/Entity/EntityProperties.tsx
  • app/client/src/pages/Editor/IDE/Layout/index.ts
  • app/client/src/pages/Editor/IDE/MainPane/index.tsx
  • app/client/src/pages/Editor/IDE/ProtectedCallout.tsx
  • app/client/src/pages/Editor/commons/EditorSettingsPaneContainer.tsx
Additional comments not posted (51)
app/client/src/components/AnimatedGridLayout/constants.ts (1)

7-10: Enhanced animation configuration is a great improvement.

The introduction of duration, friction, mass, and tension provides finer control over animations, allowing for more customized and potentially smoother transitions. This aligns well with the goal of enhancing the user experience.

app/client/src/pages/Editor/IDE/Layout/constants.ts (1)

4-15: New layout constants improve consistency and type safety.

Defining Areas and SIDEBAR_WIDTH as constants enhances the maintainability and readability of the code. Using as const ensures type safety, which is a good practice in TypeScript.

app/client/src/pages/Editor/WidgetsEditor/components/PropertyPaneWrapper.tsx (1)

14-14: Consider the trade-off between simplicity and interactivity.

The removal of state management and event handling for the property pane width simplifies the component but also makes it static. This change might affect user experience by removing the ability to adjust the sidebar width dynamically. Evaluate if this aligns with the intended user experience goals.

app/client/src/components/BottomBar/components.ts (1)

3-7: Good move towards consistency!

Switching from a theme-dependent height to a constant BOTTOM_BAR_HEIGHT ensures a predictable layout, which is beneficial for maintaining consistent UI design across different themes. This change simplifies the layout management of the BottomBar.

app/client/src/pages/Editor/IDE/index.tsx (2)

2-13: Smart use of feature flags!

The introduction of checkAnimatedIDEFlagValue to manage layout transitions based on feature flags is a great way to keep the codebase flexible and responsive to new features. This approach simplifies the rendering logic significantly.


26-26: Display name update is appropriate!

Changing the display name from "AppsmithIDE" to "AppIDE" reflects the updated functionality and helps maintain clarity in component identification.

app/client/src/pages/Editor/EditorName/components.ts (1)

Line range hint 5-27:
Great step towards uniformity!

Using IDE_HEADER_HEIGHT for both height and line-height ensures consistent styling across the component. This approach reduces dependency on theme-specific properties, making the component easier to maintain and more predictable in appearance.

app/client/src/pages/Editor/IDE/LeftPane/LibrarySidePane.tsx (1)

23-23: Consider the implications of using width: "100%".

Setting the width to "100%" allows the Flex component to be fully responsive to its parent container. This is great for adaptability but ensure that the parent container's dimensions are controlled to avoid unexpected layout issues.

Verification successful

The parent container's dimensions are controlled. The LibrarySidePane component is used within a styled.div container named LeftPaneContainer, which has a set height and overflow properties. This setup should prevent unexpected layout issues when width: "100%" is applied to LibrarySidePane.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the parent container's dimensions and ensure they are controlled.

# Test: Search for the parent container of LibrarySidePane.
rg --type tsx 'LibrarySidePane' -A 10

Length of output: 65


Script:

#!/bin/bash
# Description: Search for the usage of LibrarySidePane component in the codebase to identify its parent container.

# Test: Search for the LibrarySidePane component usage in all files.
rg 'LibrarySidePane' -A 10

Length of output: 2945

app/client/src/pages/Editor/IDE/EditorPane/index.tsx (1)

27-27: Review the impact of setting width: "100%".

Hardcoding the width to "100%" simplifies the component but may reduce its responsiveness to different layout contexts. Consider whether this change aligns with the overall design goals.

app/client/src/pages/Editor/commons/EditorHeaderComponents.tsx (1)

14-14: Evaluate the use of IDE_HEADER_HEIGHT for header height.

Switching to a fixed height constant simplifies the styling but might reduce flexibility across different themes. Ensure that IDE_HEADER_HEIGHT aligns with the design requirements across various contexts.

app/client/src/pages/Editor/commons/Omnibar.tsx (1)

6-6: Good use of constants for layout consistency.

By using IDE_HEADER_HEIGHT for the top property, you've improved the maintainability of the layout. However, keep in mind that this change reduces the flexibility to adapt to different themes, as it replaces a dynamic theme-based value with a static one.

Also applies to: 13-13

app/client/src/pages/Editor/commons/EditorWrapperContainer.tsx (1)

7-9: Centralizing height constants improves maintainability.

The use of constants like IDE_HEADER_HEIGHT, BOTTOM_BAR_HEIGHT, and PROTECTED_CALLOUT_HEIGHT for layout calculations enhances readability and maintainability. This approach makes future adjustments easier and ensures consistency across the application.

Also applies to: 20-22

app/client/src/pages/Editor/IDE/EditorPane/Editor.tsx (1)

14-21: Enhancing UI with view transitions.

The introduction of the Container component to apply view transitions is a great way to enhance the visual experience of the editor pane. This encapsulation of styling improves the UI without affecting the component's functionality.

Also applies to: 30-48

app/client/src/pages/Editor/IDE/Layout/AnimatedLayout.tsx (2)

1-10: Great use of modular imports!

The imports are well-organized, and the modular approach enhances maintainability and readability. This practice aligns with the DRY principle.


12-41: Well-structured component layout!

The AnimatedLayout function is clean and effectively uses the AnimatedGridLayout to organize different layout areas. This structure promotes clarity and separation of concerns.

app/client/src/IDE/Structure/Header.tsx (2)

4-4: Good practice using constants!

Importing IDE_HEADER_HEIGHT and using it for the header height enhances flexibility and consistency across the application. This approach makes future adjustments easier.


63-63: Dynamic height adjustment!

The use of IDE_HEADER_HEIGHT here allows for a more adaptable header design. This flexibility is crucial for maintaining a consistent UI across different components.

app/client/src/pages/AdminSettings/components.tsx (2)

4-4: Consistent use of constants!

Importing IDE_HEADER_HEIGHT ensures that the header height is consistent across different components, improving maintainability.


41-41: Simplified height calculation!

Using a fixed constant for the LoaderContainer height simplifies the styling logic and ensures consistency with the IDE's header height.

app/client/src/pages/Editor/IDE/LeftPane/index.tsx (1)

23-23: Good use of overflow: hidden.

Adding overflow: hidden; to the LeftPaneContainer helps prevent content overflow, maintaining the visual integrity of the layout. This is a good practice for ensuring that the UI remains clean and uncluttered.

app/client/src/pages/Editor/WidgetsEditor/WidgetEditorContainer.tsx (1)

14-16: Great improvement for responsiveness.

The introduction of the Container styled component with a dynamically calculated height enhances the layout's responsiveness. This ensures that the component adapts well to different screen sizes, which is essential for a smooth user experience.

app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts (1)

16-40: Well-structured logic for dynamic width calculation.

The useEditorStateLeftPaneWidth hook effectively calculates the left pane's width based on the current editor state and mode. This approach ensures that the layout adapts to different configurations, enhancing flexibility and user experience.

However, verify that all dependencies in the useEffect hook are necessary and correct. This ensures that the effect runs only when intended, preventing unnecessary re-renders.

Verification successful

Let's gather more specific information about the useEffect hook dependencies by examining the code directly. I'll generate a script to extract the useEffect hook from the useEditorStateLeftPaneWidth function.


Let's refine our approach to extract the useEffect hook by searching for the export statement of the useEditorStateLeftPaneWidth function. This will help us verify the dependencies more effectively.


Let's locate the file and inspect its contents to better understand the structure and verify the useEffect hook dependencies.


Dependencies in useEffect Hook Are Correct and Necessary

The dependencies listed in the useEffect hook of the useEditorStateLeftPaneWidth function are indeed necessary. Each dependency corresponds to a variable that influences the width calculation, ensuring the effect updates appropriately when these values change.

  • Dependencies: editorMode, segment, propertyPaneWidth, windowWidth, isPreviewMode

These dependencies are essential for the dynamic adjustment of the left pane's width, maintaining the intended functionality and user experience.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the dependencies of the useEffect hook in useEditorStateLeftPaneWidth.

# Test: Check for any missing or unnecessary dependencies in the useEffect hook.
rg --type js --context 10 'useEffect\('

Length of output: 41


Script:

#!/bin/bash
# Extract the useEffect hook from the useEditorStateLeftPaneWidth function to verify dependencies.
ast-grep --lang typescript --pattern $'function useEditorStateLeftPaneWidth() {
  $$$
  useEffect(() => {
    $$$
  }, [$$$]);
  $$$
}'

Length of output: 136


Script:

#!/bin/bash
# Refine the search to extract the useEffect hook by looking for the export statement of the useEditorStateLeftPaneWidth function.
ast-grep --lang typescript --pattern $'export const useEditorStateLeftPaneWidth = () => {
  $$$
  useEffect(() => {
    $$$
  }, [$$$]);
  $$$
}'

Length of output: 146


Script:

#!/bin/bash
# Locate the file useEditorStateLeftPaneWidth.ts and display its contents.
fd 'useEditorStateLeftPaneWidth.ts' -x cat {}

Length of output: 1679

app/client/src/components/BottomBar/index.tsx (3)

19-21: Check for consistent state management.

The useSelector hook is used to derive appId and isPreviewMode. Ensure these selectors are correctly implemented and provide the expected state values.

Verification successful

Let's broaden our search to locate the implementations or imports of getCurrentApplicationId and previewModeSelector by searching for their names in the codebase.


Selectors are correctly implemented and consistently used

The selectors getCurrentApplicationId and previewModeSelector are defined in app/client/src/selectors/editorSelectors.tsx and are used extensively across the codebase. This indicates that they are implemented correctly and provide consistent state values as expected.

  • getCurrentApplicationId is imported and used in various sagas and components, showing its role in managing application IDs.
  • previewModeSelector is similarly used in multiple components, ensuring consistent management of the preview mode state.

These findings suggest that the state management using these selectors is consistent throughout the application.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `getCurrentApplicationId` and `previewModeSelector`.

# Test: Search for the implementation of these selectors. Expect: Correct and consistent logic.
ast-grep --lang javascript --pattern $'function getCurrentApplicationId($_) { $$$ }'
ast-grep --lang javascript --pattern $'function previewModeSelector($_) { $$$ }'

Length of output: 167


Script:

#!/bin/bash
# Search for the occurrences of `getCurrentApplicationId` and `previewModeSelector` in the codebase.
rg 'getCurrentApplicationId'
rg 'previewModeSelector'

Length of output: 24150


10-13: Ensure correct usage of selectors.

The introduction of previewModeSelector replaces the viewMode prop. Verify that this selector accurately reflects the intended application state across the codebase.

Verification successful

Consistent Usage of previewModeSelector Verified

The previewModeSelector is widely and consistently used across the codebase in various components and hooks. Its integration appears to correctly replace the previous viewMode prop, ensuring the intended application state is accessed as expected.

  • Files with Usage:
    • app/client/src/pages/AppViewer/PrimaryCTA.tsx
    • app/client/src/pages/Editor/ToggleModeButton.tsx
    • app/client/src/pages/Editor/WidgetsEditor/components/LayoutSystemBasedPageViewer.tsx
    • app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts
    • app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts
    • app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.tsx
    • app/client/src/layoutSystems/common/mainContainerResizer/useMainContainerResizer.ts
    • app/client/src/components/BottomBar/index.tsx

This thorough integration suggests that the selector is functioning as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of `previewModeSelector` in the codebase.

# Test: Search for the usage of `previewModeSelector`. Expect: Consistent usage across the codebase.
rg --type javascript --type typescript 'previewModeSelector'

Length of output: 95


Script:

#!/bin/bash
# Description: Verify usage of `previewModeSelector` in the codebase.

# Test: Search for the usage of `previewModeSelector`. Expect: Consistent usage across the codebase.
rg --type typescript --type typescriptreact 'previewModeSelector'

Length of output: 100


Script:

#!/bin/bash
# Description: Verify usage of `previewModeSelector` in the codebase.

# Test: Search for the usage of `previewModeSelector`. Expect: Consistent usage across the codebase.
rg --glob '*.ts' --glob '*.tsx' 'previewModeSelector'

Length of output: 2237


35-40: Review conditional rendering logic.

The rendering of SwitchEnvironment and QuickGitActions is now based on isPreviewMode. Ensure that the conditions align with the desired application behavior.

Verification successful

Let's correct the file type identifiers and rerun the search to verify the conditional rendering logic for SwitchEnvironment and QuickGitActions.


Let's adjust our approach to search for SwitchEnvironment and QuickGitActions without specifying file types to ensure we capture their usage across the codebase.


Conditional Rendering Logic Verified

The rendering conditions for SwitchEnvironment and QuickGitActions in app/client/src/components/BottomBar/index.tsx are correctly aligned with the intended behavior. Both components are hidden when isPreviewMode is true, and QuickGitActions is further conditioned on !isAnvilEnabled. This setup ensures appropriate visibility based on the application's state.

  • SwitchEnvironment is rendered when !isPreviewMode.
  • QuickGitActions is rendered when !isPreviewMode && !isAnvilEnabled.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the conditions for rendering `SwitchEnvironment`.

# Test: Check where `SwitchEnvironment` and `QuickGitActions` are used. Expect: Correct conditional rendering based on `isPreviewMode`.
rg --type javascript --type typescript 'SwitchEnvironment'
rg --type javascript --type typescript 'QuickGitActions'

Length of output: 185


Script:

#!/bin/bash
# Description: Verify the conditions for rendering `SwitchEnvironment` and `QuickGitActions`.

# Test: Check where `SwitchEnvironment` and `QuickGitActions` are used. Expect: Correct conditional rendering based on `isPreviewMode`.
rg --type ts --type tsx 'SwitchEnvironment'
rg --type ts --type tsx 'QuickGitActions'

Length of output: 141


Script:

#!/bin/bash
# Description: Verify the conditions for rendering `SwitchEnvironment` and `QuickGitActions`.

# Test: Check where `SwitchEnvironment` and `QuickGitActions` are used. Expect: Correct conditional rendering based on `isPreviewMode`.
rg 'SwitchEnvironment'
rg 'QuickGitActions'

Length of output: 1604

app/client/src/pages/Editor/IDE/Layout/UnanimatedLayout.tsx (3)

16-25: Review grid layout styling.

The GridContainer and LayoutContainer styled components define the layout. Ensure that the grid properties are correctly set up for the intended layout.


27-61: Check component structure and memoization.

The UnanimatedLayout component uses a memoized version for performance optimization. Verify that the component structure is logical and that memoization is appropriate.


1-2: Verify import correctness.

Ensure that all imported components and hooks are correctly utilized within UnanimatedLayout. This includes checking for any unused imports.

Verification successful

Imports are correctly utilized in UnanimatedLayout.tsx.

Both React and useSelector imports are used within the file, confirming that there are no unused imports.

  • React is used in React.memo(UnanimatedLayout).
  • useSelector is used to call protectedModeSelector.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of imported components and hooks.

# Test: Check for usage of each imported component and hook. Expect: All imports are used within the file.
rg --type javascript --type typescript 'import .* from' -A 10

Length of output: 98


Script:

#!/bin/bash
# Description: Verify the usage of imported components and hooks in UnanimatedLayout.tsx.

# Locate the UnanimatedLayout.tsx file
fd 'UnanimatedLayout.tsx' --exec bash -c '
  # Check for usage of React and useSelector imports within the file
  rg "React" "$1" -A 5
  rg "useSelector" "$1" -A 5
' _ {}

Length of output: 967

app/client/src/pages/Editor/JSEditor/styledComponents.ts (2)

35-35: Review height calculation logic.

The height of FormWrapper now uses IDE_HEADER_HEIGHT. Ensure this change maintains the intended layout and does not cause any visual issues.


9-9: Ensure correct import of constants.

The IDE_HEADER_HEIGHT constant is now used in the height calculation. Verify that this constant is defined correctly and aligns with the design requirements.

Verification successful

IDE_HEADER_HEIGHT is correctly defined and used.

The constant IDE_HEADER_HEIGHT is defined as 40 in app/client/src/IDE/Structure/constants.ts, and it is consistently used across the codebase for layout calculations. This aligns with typical design requirements for header heights. No issues were found with its definition or usage.

  • Definition: app/client/src/IDE/Structure/constants.ts as export const IDE_HEADER_HEIGHT = 40;
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definition and usage of `IDE_HEADER_HEIGHT`.

# Test: Search for the definition of `IDE_HEADER_HEIGHT`. Expect: Correct value and usage across the codebase.
rg --type javascript --type typescript 'IDE_HEADER_HEIGHT'

Length of output: 93


Script:

#!/bin/bash
# Description: Verify the definition and usage of `IDE_HEADER_HEIGHT`.

# Correcting the file type identifiers and searching for the definition of `IDE_HEADER_HEIGHT`.
rg --type js --type ts 'IDE_HEADER_HEIGHT'

Length of output: 2788

app/client/src/pages/Editor/IDE/EditorTabs/ScreenModeToggle.tsx (3)

21-26: Good use of feature flag for conditional logic.

The isAnimatedIDEEnabled selector correctly checks the feature flag to determine if animations should be enabled. This is a good practice for managing feature rollouts.


48-54: Consistent transition logic for split screen mode.

The switchToSplitScreen function mirrors the logic in switchToFullScreen, ensuring consistent behavior across different screen modes. This consistency is crucial for maintainability.


35-41: Ensure fallback behavior is correct.

The switchToFullScreen function uses the startViewTransition method if available and the feature flag is enabled. Ensure that the fallback behavior (direct dispatch) works correctly when animations are not supported or disabled.

app/client/src/pages/Editor/gitSync/components/GitErrorPopup.tsx (2)

20-20: Centralize layout constants for consistency.

The use of BOTTOM_BAR_HEIGHT centralizes the layout configuration, which improves consistency and maintainability. Ensure that all related components use this constant for uniformity.


35-35: Check for consistent usage of theme variables.

The bottom property now uses a mix of a constant and theme spacing. Ensure that this approach is consistently applied across similar components to maintain a cohesive design.

app/client/src/components/editorComponents/PropertyPaneSidebar.tsx (4)

1-8: Streamline imports for improved readability.

The import statements are well-organized, making it easy to identify dependencies. Ensure that all necessary imports are included and unused ones are removed.


25-25: Simplify component interface by removing props.

The removal of the Props interface simplifies the component, reducing complexity. Ensure that any previously dependent logic on props is correctly refactored.


74-79: Optimize event listener management.

The use of useCallback for closeWalkthrough optimizes performance by preventing unnecessary re-creations. This is a good practice for managing event listeners efficiently.


82-89: Ensure proper cleanup of event listeners.

The useEffect hook correctly adds and removes event listeners, preventing potential memory leaks. Verify that this pattern is consistently applied across similar components.

app/client/src/ce/entities/FeatureFlag.ts (1)

48-48: Good addition of the feature flag.

The new feature flag release_ide_animations_enabled is correctly added. Ensure that its usage is properly integrated and tested across the codebase.

Would you like assistance in verifying its integration?

Also applies to: 86-86

Verification successful

Let's perform a more comprehensive search to verify the integration of the release_ide_animations_enabled feature flag across the entire codebase.


Feature Flag Integration Confirmed

The feature flag release_ide_animations_enabled is properly integrated into the codebase. It is used in the following locations, indicating that it is actively being utilized:

  • app/client/src/pages/Editor/IDE/EditorTabs/ScreenModeToggle.tsx
  • app/client/src/pages/Editor/IDE/index.tsx
  • Defined in app/client/src/ce/entities/FeatureFlag.ts

This confirms that the feature flag is well-integrated and ready for further testing and use. Keep up the good work!

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new feature flag `release_ide_animations_enabled`.

# Test: Search for the feature flag usage. Expect: Occurrences of the feature flag in the codebase.
rg --type js 'release_ide_animations_enabled'

Length of output: 45


Script:

#!/bin/bash
# Description: Perform a comprehensive search for the feature flag `release_ide_animations_enabled` in the entire codebase.
rg 'release_ide_animations_enabled'

Length of output: 434

app/client/src/pages/Editor/Canvas.tsx (1)

97-97: Consider the impact of removing transitions.

The removal of transition-all duration-400 from the className could affect the user experience by eliminating smooth transitions. Ensure that this change aligns with the intended design and performance goals.

Would you like to verify the impact on user experience and performance?

app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts (1)

28-127: Well-structured hook for grid layout.

The useGridLayoutTemplate hook is well-implemented, managing layout dimensions effectively. Consider adding comments to explain the logic, especially within the useEffect hooks, for better maintainability and understanding.

Would you like assistance in adding comments or further documentation?

app/client/src/layoutSystems/common/modalOverlay/ModalOverlayLayer.tsx (1)

12-12: Verify the impact of removing smallHeaderHeight.

The smallHeaderHeight property has been removed. Ensure that this does not cause any layout issues, especially in scenarios where a smaller header height was previously utilized.

app/client/src/pages/Editor/IDE/LeftPane/DataSidePane.tsx (1)

101-101: Verify the layout impact of changing width to 100%.

The width of the DataSidePane has been changed to 100%. Ensure this change does not negatively affect the layout or cause any unexpected issues, especially in different screen sizes or parent containers.

app/client/src/pages/Editor/IDE/hooks.ts (1)

Line range hint 1-1:
Verify the impact of removing useEditorPaneWidth.

The useEditorPaneWidth hook has been removed. Ensure that this change does not introduce layout issues or reduce flexibility in managing the editor pane's width.

Verification successful

Verification Successful: useEditorPaneWidth has been fully removed.

The search for useEditorPaneWidth returned no results, confirming that it has been completely removed from the codebase. Ensure that any dependent functionalities have been appropriately adjusted to prevent any layout issues.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any usage of `useEditorPaneWidth` in the codebase to ensure it has been fully removed or replaced.

# Test: Search for `useEditorPaneWidth` usage. Expect: No occurrences.
rg --type typescript 'useEditorPaneWidth'

Length of output: 76


Script:

#!/bin/bash
# Description: Check for any usage of `useEditorPaneWidth` in the codebase to ensure it has been fully removed or replaced.

# Test: Search for `useEditorPaneWidth` usage. Expect: No occurrences.
rg --type ts 'useEditorPaneWidth'

Length of output: 33

app/client/src/pages/Editor/PropertyPane/PropertyPaneTitle.tsx (2)

22-25: Good use of selectors for dynamic styling!

The introduction of getPropertyPaneWidth to dynamically set the width of the property pane is a great step towards enhancing the responsiveness of the UI. This approach ensures that the component adapts to changes in state effectively.


167-169: Great move towards flexible design!

The shift from fixed width to a state-driven width in the style attribute aligns with modern responsive design practices. This change will likely improve the user experience by allowing the layout to adapt more fluidly.

app/client/src/pages/AppViewer/Navigation/Sidebar.tsx (2)

39-40: Nice use of constants for consistency!

The use of IDE_HEADER_HEIGHT and BOTTOM_BAR_HEIGHT instead of theme-derived values is a smart move. It simplifies the component by reducing dependency on theme selectors and ensures consistent behavior across different themes.


132-135: Ensure logic consistency with new constants.

The logic for calculating the sidebar height now uses constants. Verify that these constants align with the intended design specifications and that their usage does not introduce layout issues in various scenarios.

app/client/src/pages/Editor/index.tsx (2)

53-53: Importing IDE_HEADER_HEIGHT is a good practice!

The import of IDE_HEADER_HEIGHT for use in layout calculations is a solid approach. It ensures that the layout is consistent with the defined header height, improving the adaptability of the UI.


172-172: Verify layout consistency with new height calculation.

The change in height calculation for CenteredWrapper using IDE_HEADER_HEIGHT should be tested across different scenarios to ensure it maintains the desired layout consistency and responsiveness.

const isCurrentWidgetRecentlyAdded = useSelector(
getIsCurrentWidgetRecentlyAdded,
);
const width = useSelector(getPropertyPaneWidth);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider potential performance impacts.

While using useSelector with getPropertyPaneWidth is beneficial for dynamic styling, ensure that the selector is optimized to prevent unnecessary re-renders. If getPropertyPaneWidth relies on complex state calculations, consider using reselect to memoize the selector.

@albinAppsmith
Copy link
Contributor

/build-deploy-preview skip-test=true

@github-actions
Copy link

github-actions bot commented Sep 6, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10733794301.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 35714.
recreate: .

@github-actions
Copy link

github-actions bot commented Sep 6, 2024

Deploy-Preview-URL: https://ce-35714.dp.appsmith.com

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 156296e and bff4536.

Files selected for processing (1)
  • app/client/src/pages/Editor/IDE/ProtectedCallout.test.tsx (2 hunks)
Additional comments not posted (3)
app/client/src/pages/Editor/IDE/ProtectedCallout.test.tsx (3)

10-10: Import statement for the store module.

This line imports the store module, which is essential for fetching the initial state in the getMockStore function. It's good to see that dependencies are clearly managed.


18-18: Specific state configuration for testing.

The detailed setup of the applications state within the getMockStore function is commendable. It allows for precise control over the state during tests, which is crucial for components that behave differently based on state conditions. This setup ensures that your tests can cover scenarios specific to the gitApplicationMetadata.


38-38: Return statement in getMockStore.

The return statement effectively merges the initial state with the new slice, ensuring that the test store is comprehensive and reflects any overrides provided. This is a robust approach to state management in testing, allowing for flexible and accurate test setups.

// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getMockStore = (override: Record<string, any> = {}): any => {
const initialState = store.getState();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhancements to the getMockStore function.

The modifications to getMockStore are quite thoughtful. By incorporating the actual application state (store.getState()) and merging it with overrides, you ensure that the tests can simulate more realistic scenarios. This approach is particularly beneficial for testing components that are heavily dependent on the global state.

However, let's consider a few improvements:

  1. Documentation: The function could benefit from more detailed comments explaining why certain overrides are necessary and how they affect the test environment.
  2. Type Safety: Since TypeScript is used in the project, enhancing type safety for the override parameter and the function return type could prevent potential bugs and improve maintainability.

Here's a suggested refactor to address these points:

// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
-const getMockStore = (override: Record<string, any> = {}): any => {
+/**
+ * Creates a mock store for testing.
+ * @param {Partial<RootState>} override - State overrides to apply.
+ * @returns {Store<RootState>} The mock store.
+ */
+const getMockStore = (override: Partial<RootState> = {}): Store<RootState> => {
  const initialState = store.getState();
  const slice = {
    ui: {
      ...initialState.ui,
      applications: {
        currentApplication: {
          gitApplicationMetadata: {
            branchName: "main",
            remoteUrl: "remote-url",
          },
        },
      },
      editor: {
        isPreviewMode: false,
      },
      gitSync: {
        protectedBranches: ["main"],
      },
    },
  };
  const mockStore = configureStore([]);
  const newSlice = merge(slice, override);
  return mockStore({
    ...initialState,
    ...newSlice,
  });
};

Also applies to: 18-18, 38-38

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bff4536 and 9080f5c.

Files selected for processing (2)
  • app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts (1 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitBranchProtect_spec.ts (1)

Pattern app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
Additional comments not posted (1)
app/client/src/pages/Editor/IDE/Layout/hooks/useEditorStateLeftPaneWidth.ts (1)

16-49: Review of useEditorStateLeftPaneWidth Hook

This custom hook is well-structured and uses a robust approach to dynamically adjust the left pane width based on various IDE states. The use of useWindowDimensions and Redux selectors is appropriate for accessing global state and browser properties. The dependency array in useEffect is correctly populated, ensuring that the effect runs accurately when any dependency changes.

However, there are a couple of points to consider:

  • Performance Optimization: Ensure that the selectors used in this hook, such as getPropertyPaneWidth, are memoized if they perform complex calculations. This will prevent unnecessary re-renders.
  • Robustness in Conditional Logic: The conditions inside the useEffect could be simplified or broken down into smaller functions for clarity and testability.

Overall, the implementation aligns with the PR's objectives to enhance the IDE's layout and transitions. Good job on maintaining clean and readable code.

AppSidebar.locators.sidebar,
false,
);
_.agHelper.AssertElementAbsence(AppSidebar.locators.sidebar);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhanced Clarity in Assertions

The change from AssertElementVisibility to AssertElementAbsence is a significant improvement. It makes the test assertions more precise by explicitly checking for the non-existence of the sidebar, which aligns better with the test's intent to verify the absence of certain UI elements under specific conditions.

However, consider addressing the use of cy.wait(1000). This method of waiting is generally discouraged because it can lead to flaky tests. It's better to wait for a specific condition or element to appear or disappear, which would make the tests more reliable and faster.

Overall, the modifications enhance the test suite's clarity and robustness. Good job on making these changes.

Consider replacing cy.wait(1000) with a more deterministic wait condition, such as waiting for a specific API call to complete or a UI element to become visible. This approach reduces the potential for flaky tests and improves the reliability of the test execution.

@albinAppsmith
Copy link
Contributor

/build-deploy-preview skip-test=true

@github-actions
Copy link

github-actions bot commented Sep 9, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10766393683.
Workflow: On demand build Docker image and deploy preview.
skip-tests: . env: .
PR: 35714.
recreate: .

@github-actions
Copy link

github-actions bot commented Sep 9, 2024

Deploy-Preview-URL: https://ce-35714.dp.appsmith.com

@hetunandu hetunandu merged commit 60dbda4 into release Sep 9, 2024
@hetunandu hetunandu deleted the feat/app-ide-transitions branch September 9, 2024 10:55
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
## Description

Uses `AnimatedGridLayout` component to introduce transitions for the
IDE. This is behind a feature flag

Fixes appsmithorg#34538
Fixes appsmithorg#30863 
Fixes appsmithorg#34544 

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10737363879>
> Commit: a912f5c
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10737363879&attempt=2&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.All
> Spec: 
> The following are new failures, please fix them before merging the PR:
<ol>
>
<li>cypress/e2e/Regression/ServerSide/OnLoadTests/ExecuteAction_Spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Fri, 06 Sep 2024 16:32:30 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Sagar Khalasi <sagar@appsmith.com>
@coderabbitai coderabbitai bot mentioned this pull request Oct 25, 2024
2 tasks
@coderabbitai coderabbitai bot mentioned this pull request Feb 6, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IDE Navigation Issues/feature requests related to IDE navigation, and context switching IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task]: Add responsiveness to Left pane Editor [Task]: Create layout for IDE [Task]: Add transitions for Side by Side

5 participants