Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Move Sidebar to IDE/Components #34487

Merged
merged 16 commits into from
Jul 10, 2024
Merged

chore: Move Sidebar to IDE/Components #34487

merged 16 commits into from
Jul 10, 2024

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Jun 26, 2024

Description

Separate the Sidebar Component from the various IDEs and move it to the IDE module.

Fixes #34554

Automation

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

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9869212078
Commit: 0b685d4
Cypress dashboard.
Tags: @tag.IDE
Spec:


Wed, 10 Jul 2024 06:47:16 UTC

Summary by CodeRabbit

  • New Features

    • Introduced a new sidebar component (IDESidebar) managing button states and handling interactions.
    • Added Condition enum for better condition management with icons and colors in the sidebar buttons.
  • Enhancements

    • Improved click handling for sidebar buttons with a new handleOnClick function.
  • Tests

    • Added test cases for SidebarButton component to validate different conditions and click behaviors.
  • Components

    • New React components and interfaces for managing the IDE's sidebar functionality and state.

Copy link
Contributor

coderabbitai bot commented Jun 26, 2024

Walkthrough

The changes involve enhancing the sidebar functionality in an IDE-like environment. Key modifications include introducing a new Condition enum for managing icon states, updating the SidebarButton component to handle these conditions, and adding test cases. Additionally, a new IDESidebar component is implemented for managing button states and clicks. Exports have been updated to include these new elements.

Changes

Files/Path Change Summary
.../SidebarButton/SidebarButton.tsx Added Condition enum and ConditionConfig, replaced conditionIcon with condition prop, introduced handleOnClick function.
.../SidebarButton/SidebarButton.test.tsx Added tests for SidebarButton to validate behavior under different conditions and onClick events.
.../Sidebar/Sidebar.tsx Introduced IDESidebar component to manage sidebar buttons based on editor state and handle selection/click events.
.../IDE/index.ts Updated exports to include IDSidebar, ISidebarButton, and Condition.
.../Editor/IDE/Sidebar.tsx Introduced Sidebar component managing IDE sidebar functionality and managing state updates and navigation actions.

Sequence Diagram(s)

sequenceDiagram
    actor User
    User->>IDESidebar: Click Button
    IDESidebar->>SidebarButton: Update State
    SidebarButton->>IDESidebar: Reflect Condition
    User->>IDESidebar: Navigate based on Condition
Loading

Poem

In the code, a rabbit's leap,
Sidebar buttons now can speak.
With icons bright and tasks so clear,
Clicking through with boundless cheer.
Tests are running, quite the spree,
For the sidebar's harmony.
🎈✨


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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Jun 26, 2024
Copy link

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 1, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

Copy link

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 1, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

Copy link

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 1, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

@github-actions github-actions bot added the Task A simple Todo label Jun 27, 2024
@hetunandu hetunandu added the ok-to-test Required label for CI label Jun 28, 2024
@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 28, 2024
@hetunandu hetunandu marked this pull request as ready for review June 28, 2024 08:56
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: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8979e07 and 1156e73.

Files selected for processing (9)
  • app/client/src/IDE/Components/BottomView.tsx (1 hunks)
  • app/client/src/IDE/Components/Sidebar/SidebarButton.test.tsx (1 hunks)
  • app/client/src/IDE/Components/Sidebar/SidebarButton.tsx (3 hunks)
  • app/client/src/IDE/Components/Sidebar/index.tsx (1 hunks)
  • app/client/src/IDE/index.ts (1 hunks)
  • app/client/src/api/LibraryAPI.tsx (1 hunks)
  • app/client/src/ce/entities/IDE/constants.ts (3 hunks)
  • app/client/src/pages/Editor/IDE/Sidebar/index.tsx (2 hunks)
  • app/client/src/pages/Editor/JSEditor/constants.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/pages/Editor/JSEditor/constants.ts
Additional context used
Biome
app/client/src/api/LibraryAPI.tsx

[error] 5-33: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

Additional comments not posted (12)
app/client/src/IDE/Components/Sidebar/SidebarButton.test.tsx (2)

8-13: Ensure comprehensive prop setup for testing.

The sidebarButtonProps setup appears to be comprehensive for the test scenario, including all necessary properties. This setup ensures that the component can be tested under controlled conditions.


16-26: Validate rendering logic under specific conditions.

The test checks if the warning icon renders correctly when the condition prop is set to Warn. This is a good practice as it ensures that the component behaves as expected under different conditions.

app/client/src/IDE/Components/Sidebar/index.tsx (2)

35-78: Good use of React hooks and callback optimization.

The SidebarComponent uses useCallback effectively to optimize the rendering performance. The structured and clean implementation of the component with conditional rendering and hooks demonstrates good React practices.


18-25: Consider relocating ISidebarButton interface.

As per the past review comment, consider moving the ISidebarButton interface to a constants file to improve organization and reusability.

- export interface ISidebarButton {
-   state: EditorState;
-   icon: string;
-   title?: string;
-   urlSuffix: string;
-   condition?: Condition;
-   tooltip?: string;
- }
+ // This interface should be moved to a more central location like `constants.ts`.
app/client/src/pages/Editor/IDE/Sidebar/index.tsx (2)

22-46: Dynamic update of button states based on datasource availability.

The use of useEffect to dynamically update the topButtons based on the availability of datasources is a robust design choice. It ensures that the UI reflects the current state accurately and provides feedback to the user.


68-73: Proper integration of IDESidebar.

The Sidebar component integrates IDESidebar effectively, passing all necessary props and handling state changes appropriately. This modular approach enhances maintainability and reusability.

app/client/src/IDE/Components/Sidebar/SidebarButton.tsx (2)

5-19: Well-defined Condition enum and configuration.

The introduction of the Condition enum and the corresponding ConditionConfig enhances the component's flexibility and readability by mapping conditions to visual representations.


85-88: Conditional rendering of icons based on condition.

The implementation of conditional rendering for the ConditionIcon based on the condition prop is a good practice. It ensures that the UI elements are only rendered when necessary, improving performance.

app/client/src/IDE/index.ts (1)

47-49: Ensure correct export paths and types for Sidebar-related entities.

The new exports for IDESidebar, ISidebarButton, and Condition are introduced. It's crucial to ensure that these components are correctly implemented and exported from their respective files. The comments provide a good overview of the IDESidebar.

app/client/src/ce/entities/IDE/constants.ts (2)

Line range hint 61-86: Review initialization of TopButtons and BottomButtons arrays.

The arrays TopButtons and BottomButtons have been updated to include the tooltip and urlSuffix properties. Ensure that these properties are being utilized correctly in the Sidebar component.


24-25: Validate the introduction of ISidebarButton type.

The ISidebarButton type has been imported and is being used in the definition of TopButtons and BottomButtons. It's important to ensure that this type is correctly defined in the referenced location.

app/client/src/IDE/Components/BottomView.tsx (1)

6-7: Review updated import paths and usage of view behaviors.

The import paths for CodeEditorWithGutterStyles and view behaviors have been updated. Verify that these changes are correctly reflected in the usage within the component.

Verification successful

Verified correct import and usage of CodeEditorWithGutterStyles and view behaviors.

The imports for CodeEditorWithGutterStyles, ViewDisplayMode, and ViewHideBehaviour are correctly reflected and used within the BottomView component.

  • Import Statements:

    import { CodeEditorWithGutterStyles } from "pages/Editor/JSEditor/styledComponents";
    import { ViewDisplayMode, ViewHideBehaviour } from "IDE/Interfaces/View";
  • Usage:

    const Container = styled.div<{ displayMode: ViewDisplayMode }>`
          case ViewDisplayMode.OVERLAY:
          ${CodeEditorWithGutterStyles};
      [ViewHideBehaviour.COLLAPSE]: `${VIEW_MIN_HEIGHT}px`,
      [ViewHideBehaviour.CLOSE]: "0px",
      behaviour: ViewHideBehaviour;
      displayMode?: ViewDisplayMode;
      hideBehaviour: ViewHideBehaviour;
        return props.hideBehaviour === ViewHideBehaviour.CLOSE
        if (props.hideBehaviour === ViewHideBehaviour.COLLAPSE) {
          displayMode={props.displayMode || ViewDisplayMode.BLOCK}

The code changes are consistent and correctly implemented.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct import and usage of `CodeEditorWithGutterStyles` and view behaviors.

# Test: Search for the usage of `CodeEditorWithGutterStyles` and view behaviors.
rg --type typescript $'CodeEditorWithGutterStyles|ViewHideBehaviour|ViewDisplayMode' app/client/src/IDE/Components/BottomView.tsx

Length of output: 165



Script:

#!/bin/bash
# Description: Verify the correct import and usage of `CodeEditorWithGutterStyles` and view behaviors.

# Test: Search for the usage of `CodeEditorWithGutterStyles` and view behaviors.
rg 'CodeEditorWithGutterStyles|ViewHideBehaviour|ViewDisplayMode' app/client/src/IDE/Components/BottomView.tsx

Length of output: 785

app/client/src/api/LibraryAPI.tsx Show resolved Hide resolved
app/client/src/IDE/Components/Sidebar/SidebarButton.tsx Outdated Show resolved Hide resolved
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: 0

Outside diff range and nitpick comments (1)
app/client/src/IDE/Components/Sidebar/SidebarButton.tsx (1)

Line range hint 1-83: SidebarButton Component Needs Completion of Condition Configurations

The SidebarButton component is well-implemented with conditional rendering of icons based on the condition prop. However, the TODO comments indicate that further configurations for different conditions are needed. Completing these would ensure consistency and completeness of visual feedback.

Would you like me to help complete this configuration?

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1156e73 and 0d560d1.

Files selected for processing (7)
  • app/client/src/IDE/Components/Sidebar/SidebarButton.test.tsx (1 hunks)
  • app/client/src/IDE/Components/Sidebar/SidebarButton.tsx (3 hunks)
  • app/client/src/IDE/Components/Sidebar/index.tsx (1 hunks)
  • app/client/src/IDE/Interfaces/Condition.ts (1 hunks)
  • app/client/src/IDE/Interfaces/ISidebarButton.ts (1 hunks)
  • app/client/src/IDE/index.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/Sidebar.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/IDE/Interfaces/Condition.ts
Additional comments not posted (6)
app/client/src/IDE/Interfaces/ISidebarButton.ts (1)

1-12: Interface Definition for Sidebar Buttons: Looks Good

The ISidebarButton interface is well-defined with appropriate properties that support different states and conditions of sidebar buttons. This should facilitate the implementation of dynamic and responsive sidebar buttons in the IDE.

app/client/src/IDE/Components/Sidebar/SidebarButton.test.tsx (1)

1-25: Comprehensive Test for SidebarButton Component

The test setup for SidebarButton is appropriately configured to check the rendering behavior under specific conditions (empty datasource list). The use of props to simulate this scenario and the assertion on the number of rendered SVGs are correctly implemented.

app/client/src/IDE/Components/Sidebar/index.tsx (1)

1-72: Well-structured IDESidebar Component

The IDESidebar component is well-implemented with clear separation of concerns and effective use of React hooks for performance optimization. The component logic for handling button clicks and rendering based on the app state is correctly implemented.

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

1-78: Comprehensive Sidebar Component with Dynamic Button States

The Sidebar component effectively integrates with Redux and uses hooks to manage side effects and state transitions. The logic to dynamically update button states based on datasource availability is crucial for a responsive user experience.

app/client/src/IDE/index.ts (2)

43-47: Export of IDESidebar Component

The export of the IDESidebar component from ./Components/Sidebar is correctly implemented. This aligns with the PR's goal of restructuring the Sidebar component within the IDE module.


55-56: Export of Interfaces and Types

The export of ISidebarButton and Condition interfaces is correctly implemented. It's essential to ensure that these interfaces are used consistently throughout the project.

Verification successful

Export of Interfaces and Types

The export of ISidebarButton and Condition interfaces is correctly implemented and these interfaces are used consistently throughout the project.

  • Instances of ISidebarButton found in:

    • app/client/src/IDE/Interfaces/ISidebarButton.ts
    • app/client/src/IDE/Components/Sidebar/index.tsx
    • app/client/src/IDE/Components/Sidebar/SidebarButton.tsx
    • app/client/src/ce/entities/IDE/constants.ts
  • Instances of Condition found in:

    • app/client/src/IDE/Interfaces/Condition.ts
    • app/client/src/IDE/Components/Sidebar/SidebarButton.tsx
    • app/client/src/widgets/TableWidgetV2/component/Constants.ts
    • app/client/src/widgets/TableWidgetV2/component/header/actions/filter/CascadeFields.tsx
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify consistent use of `ISidebarButton` and `Condition` interfaces across the project.

# Test: Search for the interface usage. Expect: Consistent usage across the project.
rg --type typescript $'ISidebarButton|Condition'

Length of output: 84



Script:

#!/bin/bash
# Description: Verify consistent use of `ISidebarButton` and `Condition` interfaces across the project.

# Test: Search for the interface usage. Expect: Consistent usage across the project.
rg 'ISidebarButton|Condition' --glob '*.ts' --glob '*.tsx'

Length of output: 38386

@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 28, 2024
app/client/src/IDE/Interfaces/Condition.ts Outdated Show resolved Hide resolved
app/client/src/IDE/Interfaces/ISidebarButton.ts Outdated Show resolved Hide resolved
app/client/src/IDE/Interfaces/ISidebarButton.ts Outdated Show resolved Hide resolved
app/client/src/IDE/Components/Sidebar/index.tsx Outdated Show resolved Hide resolved
app/client/src/IDE/Components/Sidebar/index.tsx Outdated Show resolved Hide resolved
app/client/src/IDE/Components/Sidebar/index.tsx Outdated Show resolved Hide resolved
app/client/src/pages/Editor/IDE/Sidebar.tsx Outdated Show resolved Hide resolved
app/client/src/pages/Editor/IDE/Sidebar.tsx Outdated Show resolved Hide resolved
@github-actions github-actions bot added IDE Navigation Issues/feature requests related to IDE navigation, and context switching IDE Pod Issues that new developers face while exploring the IDE labels Jul 2, 2024
@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 5, 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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c88428c and 71e5795.

Files selected for processing (4)
  • app/client/src/IDE/Components/Sidebar/Sidebar.tsx (1 hunks)
  • app/client/src/IDE/Components/Sidebar/SidebarButton/SidebarButton.tsx (1 hunks)
  • app/client/src/IDE/index.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/Sidebar.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • app/client/src/IDE/Components/Sidebar/Sidebar.tsx
  • app/client/src/IDE/Components/Sidebar/SidebarButton/SidebarButton.tsx
  • app/client/src/IDE/index.ts
  • app/client/src/pages/Editor/IDE/Sidebar.tsx

albinAppsmith
albinAppsmith previously approved these changes Jul 8, 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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 71e5795 and f2d0e9f.

Files selected for processing (2)
  • app/client/src/IDE/Components/Sidebar/SidebarButton/SidebarButton.test.tsx (1 hunks)
  • app/client/src/IDE/Components/Sidebar/SidebarButton/SidebarButton.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/client/src/IDE/Components/Sidebar/SidebarButton/SidebarButton.test.tsx
  • app/client/src/IDE/Components/Sidebar/SidebarButton/SidebarButton.tsx

@ApekshaBhosale
Copy link
Contributor

@coderabbitai generate unit tests

Copy link
Contributor

coderabbitai bot commented Jul 8, 2024

@ApekshaBhosale, I've generated the unit tests for the SidebarButton and IDESidebar components. Here are the test cases:

SidebarButton.test.tsx

import React from "react";
import { render, fireEvent } from "@testing-library/react";
import SidebarButton, { SidebarButtonProps } from "./SidebarButton";
import { Condition } from "../../../enums";

describe("SidebarButton", () => {
  const defaultProps: SidebarButtonProps = {
    condition: Condition.DEFAULT,
    onClick: jest.fn(),
    // other default props
  };

  it("should render the button with default condition", () => {
    const { getByRole } = render(<SidebarButton {...defaultProps} />);
    const button = getByRole("button");
    expect(button).toBeInTheDocument();
    // Add more assertions based on default condition
  });

  it("should render the button with warning condition", () => {
    const props = { ...defaultProps, condition: Condition.WARNING };
    const { getByRole } = render(<SidebarButton {...props} />);
    const button = getByRole("button");
    expect(button).toBeInTheDocument();
    // Add more assertions based on warning condition
  });

  it("should call onClick when button is clicked", () => {
    const { getByRole } = render(<SidebarButton {...defaultProps} />);
    const button = getByRole("button");
    fireEvent.click(button);
    expect(defaultProps.onClick).toHaveBeenCalled();
  });
});

IDESidebar.test.tsx

import React from "react";
import { render, fireEvent } from "@testing-library/react";
import IDESidebar, { IDESidebarProps } from "./IDESidebar";
import { Condition } from "../../../enums";

describe("IDESidebar", () => {
  const defaultProps: IDESidebarProps = {
    buttons: [
      { id: "1", label: "Button 1", condition: Condition.DEFAULT, onClick: jest.fn() },
      { id: "2", label: "Button 2", condition: Condition.WARNING, onClick: jest.fn() },
    ],
    // other default props
  };

  it("should render all buttons", () => {
    const { getByText } = render(<IDESidebar {...defaultProps} />);
    defaultProps.buttons.forEach(button => {
      expect(getByText(button.label)).toBeInTheDocument();
    });
  });

  it("should handle button click events", () => {
    const { getByText } = render(<IDESidebar {...defaultProps} />);
    const button = getByText("Button 1");
    fireEvent.click(button);
    expect(defaultProps.buttons[0].onClick).toHaveBeenCalled();
  });

  // Add more tests based on different conditions and props
});

These tests cover the basic rendering and interaction scenarios for the SidebarButton and IDESidebar components. Let me know if you need any additional test cases or modifications.

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hetunandu hetunandu requested a review from albinAppsmith July 8, 2024 10:42
@ApekshaBhosale
Copy link
Contributor

@coderabbitai generate test plan

Copy link
Contributor

coderabbitai bot commented Jul 8, 2024

Tip

For best results, initiate chat on the files or code changes.

@ApekshaBhosale, here is the detailed test plan for the SidebarButton and IDESidebar components:

Test Plan for SidebarButton

  1. Rendering Tests

    • Verify that the SidebarButton renders correctly with the default props.
    • Verify that the SidebarButton renders correctly with different condition values (e.g., Condition.DEFAULT, Condition.WARNING).
  2. Prop Handling Tests

    • Verify that the SidebarButton correctly applies the condition prop and displays the appropriate icon or style.
    • Verify that the SidebarButton correctly handles other props such as label, disabled, etc.
  3. Interaction Tests

    • Verify that the onClick event handler is called when the button is clicked.
    • Verify that the button does not trigger the onClick event when it is disabled.
  4. Condition-based Rendering Tests

    • Verify that the SidebarButton displays the correct icon or style based on the condition prop.
    • Verify that the SidebarButton handles edge cases for the condition prop, such as invalid values.

Test Plan for IDESidebar

  1. Rendering Tests

    • Verify that the IDESidebar renders correctly with the default props.
    • Verify that the IDESidebar renders all the buttons passed as props.
  2. Prop Handling Tests

    • Verify that the IDESidebar correctly applies the buttons prop and renders each button with the correct label and condition.
    • Verify that the IDESidebar correctly handles other props such as orientation, className, etc.
  3. Interaction Tests

    • Verify that the onClick event handler for each button is called when the button is clicked.
    • Verify that the IDESidebar updates the state correctly when a button is clicked.
  4. Condition-based Rendering Tests

    • Verify that the IDESidebar displays buttons with the correct icons or styles based on their condition prop.
    • Verify that the IDESidebar handles edge cases for the condition prop of buttons, such as invalid values.
  5. State Management Tests

    • Verify that the IDESidebar updates its internal state correctly based on interactions and props.
    • Verify that the IDESidebar handles state updates correctly when props change dynamically.

This test plan covers the essential scenarios to ensure that the SidebarButton and IDESidebar components function correctly and handle various conditions and interactions as expected. Let me know if you need any additional details or modifications.

condition?: Condition;
}

const Container = styled(Flex)`
Copy link
Collaborator

Choose a reason for hiding this comment

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

All these can be passed to the Flex component as prop.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@hetunandu hetunandu removed the ok-to-test Required label for CI label Jul 10, 2024
@hetunandu hetunandu added the ok-to-test Required label for CI label Jul 10, 2024
@hetunandu hetunandu merged commit 00a7d3c into release Jul 10, 2024
41 checks passed
@hetunandu hetunandu deleted the chore/ide-sidebar branch July 10, 2024 08:53
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Jul 10, 2024
## Description

Separate the Sidebar Component from the various IDEs and move it to the
IDE module.

Fixes appsmithorg#34554

## Automation

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



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


<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9869212078>
> Commit: 0b685d4
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9869212078&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IDE`
> Spec:
> <hr>Wed, 10 Jul 2024 06:47:16 UTC
<!-- end of auto-generated comment: Cypress test results  -->





<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new sidebar component (`IDESidebar`) managing button
states and handling interactions.
- Added `Condition` enum for better condition management with icons and
colors in the sidebar buttons.
  
- **Enhancements**
- Improved click handling for sidebar buttons with a new `handleOnClick`
function.
  
- **Tests**
- Added test cases for `SidebarButton` component to validate different
conditions and click behaviors.

- **Components**
- New React components and interfaces for managing the IDE's sidebar
functionality and state.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Oct 25, 2024
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 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.

Move Sidebar into IDE Module
5 participants