Skip to content

chore: Moving static layout styled components to a common file for re-using on EE#39379

Merged
ankitakinger merged 5 commits intoreleasefrom
chore/refactor-components
Feb 20, 2025
Merged

chore: Moving static layout styled components to a common file for re-using on EE#39379
ankitakinger merged 5 commits intoreleasefrom
chore/refactor-components

Conversation

@ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Feb 20, 2025

Description

  • Moving static layout styled components to a common file for re-using on EE
  • Updating AppIDE folder name: layout to layouts
  • Showing the Add button for libraries via props to re-use the component on EE

Fixes #39037

Automation

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

🔍 Cypress test results

Tip

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


Thu, 20 Feb 2025 14:41:02 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced an option in the libraries panel to conditionally display an “add” button, offering a more dynamic experience.
    • Added new layout components to facilitate better layout management within the application.
  • Refactor

    • Enhanced layout management through unified grid-based components for improved visual consistency.
    • Updated component interfaces to accept new props for enhanced functionality.
    • Adjusted import paths to reflect a restructured file organization.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2025

Walkthrough

The changes update the application's layout and library components. New styled components, GridContainer and LayoutContainer, are introduced in the layout module and replace local definitions in the static layout. Library-related components now accept a new showAddButton prop that drives conditional rendering of an add button. Additionally, several import paths have been updated to reflect a directory name change. These modifications streamline layout management and prop-driven UI behavior.

Changes

Files Summary
app/client/src/IDE/Components/LayoutComponents.tsx
app/client/src/pages/AppIDE/layouts/StaticLayout.tsx
app/client/src/pages/AppIDE/AppIDE.tsx
Introduces and centralizes styled layout components (GridContainer, LayoutContainer), updates import paths, and removes local definitions in favor of centralized components.
app/client/src/ce/pages/AppIDE/components/LibrariesList/LibrarySidePane.tsx
app/client/src/pages/AppIDE/components/LibrariesList/JSLibrariesSection.tsx
app/client/src/layouts/routers/LeftPane.tsx
Updates library components to accept and propagate the showAddButton prop, enabling conditional rendering of the add button component within the UI.
app/client/src/ce/pages/common/AppHeader.tsx
app/client/src/pages/Editor/GlobalHotKeys/GlobalHotKeys.test.tsx
app/client/test/testMockedWidgets.tsx
Updates import paths for the IDE component to reflect a change from a singular "component" directory to a plural "layouts" directory.

Sequence Diagram(s)

sequenceDiagram
    participant LP as LeftPane
    participant LSP as LibrarySidePane
    participant JSL as JSLibrariesSection
    participant ALP as AddLibraryPopover

    LP->>LSP: Render with showAddButton prop
    LSP->>JSL: Pass showAddButton prop
    alt showAddButton is true
      JSL->>ALP: Render AddLibraryPopover
    else showAddButton is false
      JSL->>JSL: Skip rendering AddLibraryPopover
    end
Loading

Possibly related PRs

Suggested labels

Enhancement

Suggested reviewers

  • AmanAgarwal041
  • sagar-qa007
  • hetunandu
  • ankitakinger

Poem

In grids and layouts our code takes flight,
With styled components shining bright.
A button appears just when it’s due,
Prop-driven and crisp in its debut.
Cheers to clean design and logic so clear!
Happy coding, our vision is dear!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61dbfd5 and bafebbe.

📒 Files selected for processing (1)
  • app/client/src/pages/AppIDE/components/ProtectedCallout/ProtectedCallout.test.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/pages/AppIDE/components/ProtectedCallout/ProtectedCallout.test.tsx
⏰ Context from checks skipped due to timeout of 90000ms (60)
  • GitHub Check: perform-test / ci-test / ci-test (59)
  • GitHub Check: perform-test / ci-test / ci-test (58)
  • GitHub Check: perform-test / ci-test / ci-test (57)
  • GitHub Check: perform-test / ci-test / ci-test (56)
  • GitHub Check: perform-test / ci-test / ci-test (55)
  • GitHub Check: perform-test / ci-test / ci-test (54)
  • GitHub Check: perform-test / ci-test / ci-test (53)
  • GitHub Check: perform-test / ci-test / ci-test (52)
  • GitHub Check: perform-test / ci-test / ci-test (51)
  • GitHub Check: perform-test / ci-test / ci-test (50)
  • GitHub Check: perform-test / ci-test / ci-test (49)
  • GitHub Check: perform-test / ci-test / ci-test (48)
  • GitHub Check: perform-test / ci-test / ci-test (47)
  • GitHub Check: perform-test / ci-test / ci-test (46)
  • GitHub Check: perform-test / ci-test / ci-test (45)
  • GitHub Check: perform-test / ci-test / ci-test (44)
  • GitHub Check: perform-test / ci-test / ci-test (43)
  • GitHub Check: perform-test / ci-test / ci-test (42)
  • GitHub Check: perform-test / ci-test / ci-test (41)
  • GitHub Check: perform-test / ci-test / ci-test (40)
  • GitHub Check: perform-test / ci-test / ci-test (39)
  • GitHub Check: perform-test / ci-test / ci-test (38)
  • GitHub Check: perform-test / ci-test / ci-test (37)
  • GitHub Check: perform-test / ci-test / ci-test (36)
  • GitHub Check: perform-test / ci-test / ci-test (35)
  • GitHub Check: perform-test / ci-test / ci-test (34)
  • GitHub Check: perform-test / ci-test / ci-test (33)
  • GitHub Check: perform-test / ci-test / ci-test (32)
  • GitHub Check: perform-test / ci-test / ci-test (31)
  • GitHub Check: perform-test / ci-test / ci-test (30)
  • GitHub Check: perform-test / ci-test / ci-test (29)
  • GitHub Check: perform-test / ci-test / ci-test (28)
  • GitHub Check: perform-test / ci-test / ci-test (27)
  • GitHub Check: perform-test / ci-test / ci-test (26)
  • GitHub Check: perform-test / ci-test / ci-test (25)
  • GitHub Check: perform-test / ci-test / ci-test (24)
  • GitHub Check: perform-test / ci-test / ci-test (23)
  • GitHub Check: perform-test / ci-test / ci-test (22)
  • GitHub Check: perform-test / ci-test / ci-test (21)
  • GitHub Check: perform-test / ci-test / ci-test (20)
  • GitHub Check: perform-test / ci-test / ci-test (19)
  • GitHub Check: perform-test / ci-test / ci-test (18)
  • GitHub Check: perform-test / ci-test / ci-test (17)
  • GitHub Check: perform-test / ci-test / ci-test (16)
  • GitHub Check: perform-test / ci-test / ci-test (15)
  • GitHub Check: perform-test / ci-test / ci-test (14)
  • GitHub Check: perform-test / ci-test / ci-test (13)
  • GitHub Check: perform-test / ci-test / ci-test (12)
  • GitHub Check: perform-test / ci-test / ci-test (11)
  • GitHub Check: perform-test / ci-test / ci-test (10)
  • GitHub Check: perform-test / ci-test / ci-test (9)
  • GitHub Check: perform-test / ci-test / ci-test (8)
  • GitHub Check: perform-test / ci-test / ci-test (7)
  • GitHub Check: perform-test / ci-test / ci-test (6)
  • GitHub Check: perform-test / ci-test / ci-test (5)
  • GitHub Check: perform-test / ci-test / ci-test (4)
  • GitHub Check: perform-test / ci-test / ci-test (3)
  • GitHub Check: perform-test / ci-test / ci-test (2)
  • GitHub Check: perform-test / ci-test / ci-test (1)
  • GitHub Check: perform-test / ci-test / ci-test (0)

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@ankitakinger ankitakinger added the ok-to-test Required label for CI label Feb 20, 2025
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Feb 20, 2025
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

🧹 Nitpick comments (6)
app/client/src/IDE/Components/LayoutComponents.tsx (2)

3-7: Consider using width: 100% instead of 100vw

Using 100vw for width can cause horizontal scrollbars to appear unexpectedly when the vertical scrollbar is present, as it includes the scrollbar width in the calculation.

-  width: 100vw;
+  width: 100%;

9-12: Consider adding a Props interface for better type documentation

The inline prop type could be moved to a named interface for better reusability and documentation.

+interface LayoutContainerProps {
+  name: string;
+}
+
-export const LayoutContainer = styled.div<{ name: string }>`
+export const LayoutContainer = styled.div<LayoutContainerProps>`
app/client/src/ce/pages/AppIDE/components/LibrariesList/LibrarySidePane.tsx (1)

5-7: Add Props interface and default prop value

Consider adding a Props interface and defaultProps to handle cases where showAddButton is not provided.

+interface LibrarySidePaneProps {
+  showAddButton: boolean;
+}
+
-const LibrarySidePane = (props: { showAddButton: boolean }) => {
+const LibrarySidePane = (props: LibrarySidePaneProps) => {
  const { showAddButton } = props;

+LibrarySidePane.defaultProps = {
+  showAddButton: false,
+};
app/client/src/pages/AppIDE/components/LibrariesList/JSLibrariesSection.tsx (1)

10-11: Add Props interface for better type documentation

Consider adding a Props interface for better code organization and documentation.

+interface JSLibrariesSectionProps {
+  showAddButton: boolean;
+}
+
-function JSLibrariesSection(props: { showAddButton: boolean }) {
+function JSLibrariesSection(props: JSLibrariesSectionProps) {
app/client/src/pages/AppIDE/layouts/StaticLayout.tsx (2)

18-21: Group related imports together

Consider grouping the layout component imports with other component imports for better code organization.

import Sidebar from "./routers/Sidebar";
import LeftPane from "./routers/LeftPane";
import MainPane from "./routers/MainPane";
import RightPane from "./routers/RightPane";
+import {
+  GridContainer,
+  LayoutContainer,
+} from "IDE/Components/LayoutComponents";
import { ProtectedCallout } from "../components/ProtectedCallout";
import { useGridLayoutTemplate } from "./hooks/useGridLayoutTemplate";
import { Areas } from "./constants";
-import {
-  GridContainer,
-  LayoutContainer,
-} from "IDE/Components/LayoutComponents";

38-38: Consider adding comparison function to React.memo

The component uses React.memo without a comparison function. Consider adding one to optimize re-renders if needed.

-export const StaticLayout = React.memo(() => {
+export const StaticLayout = React.memo(
+  () => {
    // Component implementation
+  },
+  (prevProps, nextProps) => {
+    // Add comparison logic if needed
+    return true;
+  },
+);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6dfbfe2 and 45392d2.

📒 Files selected for processing (6)
  • app/client/src/IDE/Components/LayoutComponents.tsx (1 hunks)
  • app/client/src/ce/pages/AppIDE/components/LibrariesList/LibrarySidePane.tsx (1 hunks)
  • app/client/src/pages/AppIDE/AppIDE.tsx (1 hunks)
  • app/client/src/pages/AppIDE/components/LibrariesList/JSLibrariesSection.tsx (2 hunks)
  • app/client/src/pages/AppIDE/layouts/StaticLayout.tsx (1 hunks)
  • app/client/src/pages/AppIDE/layouts/routers/LeftPane.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/pages/AppIDE/AppIDE.tsx
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (1)
app/client/src/pages/AppIDE/layouts/routers/LeftPane.tsx (1)

65-67: LGTM! Good use of render props pattern.

The change from component prop to render prop allows passing the showAddButton prop while maintaining route functionality.

@github-actions github-actions bot added IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Task A simple Todo labels Feb 20, 2025
@ankitakinger ankitakinger merged commit c21e5ed into release Feb 20, 2025
87 checks passed
@ankitakinger ankitakinger deleted the chore/refactor-components branch February 20, 2025 15:04
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
…-using on EE (appsmithorg#39379)

## Description

- Moving static layout styled components to a common file for re-using
on EE
- Updating AppIDE folder name: `layout` to `layouts`
- Showing the Add button for libraries via props to re-use the component
on EE

Fixes [appsmithorg#39037](appsmithorg#39037)

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13436155470>
> Commit: bafebbe
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13436155470&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Thu, 20 Feb 2025 14:41:02 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 an option in the libraries panel to conditionally display
an “add” button, offering a more dynamic experience.
- Added new layout components to facilitate better layout management
within the application.

- **Refactor**
- Enhanced layout management through unified grid-based components for
improved visual consistency.
- Updated component interfaces to accept new props for enhanced
functionality.
  - Adjusted import paths to reflect a restructured file organization.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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]: Implement new folder structure for Package IDE

2 participants