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

feat: Added zone component to UQI #35316

Merged
merged 6 commits into from
Aug 2, 2024
Merged

Conversation

albinAppsmith
Copy link
Collaborator

@albinAppsmith albinAppsmith commented Jul 31, 2024

Description

Added zone component to the UQI. This component will maintain the single and double column layout.

Fixes #35214

Automation

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

🔍 Cypress test results

Tip

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


Thu, 01 Aug 2024 07:35:05 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Introduced a new Section component for modular UI design, facilitating easy integration of standalone and non-standalone sections.
    • Added a Zone component to manage layout options with single-column and double-column formats, enhancing layout flexibility.
    • New CSS modules for Section and Zone components improve styling and responsiveness across different screen sizes.
    • Created a centralized entry point for streamlined access to Section and Zone functionalities.

Copy link
Contributor

coderabbitai bot commented Jul 31, 2024

Walkthrough

This update introduces two new React functional components, Section and Zone, which enhance the UI's modularity and responsiveness. The Zone component supports both single and double-column layouts, adapting dynamically based on available width. These improvements align with the goal of creating a more flexible user interface that responds well to different screen sizes and layout requirements.

Changes

Files Change Summary
app/client/src/pages/Editor/ActionForm/Section/index.tsx, styles.module.css Introduced Section component with customizable props for standalone display and scoped styles for improved layout and readability.
app/client/src/pages/Editor/ActionForm/Zone/index.tsx, styles.module.css Added Zone component to manage child layouts with single and double-column views, including CSS Grid styles for responsiveness.
app/client/src/pages/Editor/ActionForm/index.ts Created an entry point for re-exporting Section and Zone components, streamlining imports and enhancing modularity.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Zone as Zone Component
    participant Section as Section Component

    User->>Zone: Select layout (single/double column)
    Zone->>Section: Render sections based on layout
    Section-->>Zone: Display content
    Zone-->>User: Show updated layout
Loading

Assessment against linked issues

Objective Addressed Explanation
Responsive Zone with single and double columns (35214)
Collapse double column to single below width

In the realm of code, changes take flight,
Components now dance, bringing delight.
Sections and zones, so fresh and so bright,
Responsive layouts, a wonderful sight!
Flex and grid styles, adapting with grace,
A user-friendly journey, we now embrace! 🌟


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 Configuration 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 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 labels Jul 31, 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

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

9-14: Nicely implemented component!

The Zone component is correctly implemented, applying styles based on the layout prop.

Consider adding PropTypes for runtime type checking.

import PropTypes from 'prop-types';

Zone.propTypes = {
  children: PropTypes.node.isRequired,
  layout: PropTypes.oneOf(['single-column', 'double-column']),
};
app/client/src/pages/Editor/ActionForm/Section/index.tsx (1)

9-18: Nicely implemented component!

The Section component is correctly implemented, applying styles based on the isStandalone prop.

Consider adding PropTypes for runtime type checking.

import PropTypes from 'prop-types';

Section.propTypes = {
  children: PropTypes.node.isRequired,
  isStandalone: PropTypes.bool,
};
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d780ecb and 06a19a5.

Files selected for processing (5)
  • app/client/src/pages/Editor/ActionForm/Section/index.tsx (1 hunks)
  • app/client/src/pages/Editor/ActionForm/Section/styles.module.css (1 hunks)
  • app/client/src/pages/Editor/ActionForm/Zone/index.tsx (1 hunks)
  • app/client/src/pages/Editor/ActionForm/Zone/styles.module.css (1 hunks)
  • app/client/src/pages/Editor/ActionForm/index.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • app/client/src/pages/Editor/ActionForm/Section/styles.module.css
  • app/client/src/pages/Editor/ActionForm/index.ts
Additional comments not posted (10)
app/client/src/pages/Editor/ActionForm/Zone/index.tsx (3)

1-2: Good job with the imports!

The necessary imports for React and the CSS module are correctly included.


4-7: Well-defined interface!

The ZoneProps interface is correctly defined with children and an optional layout prop.


17-17: Correct export statement!

The Zone component is correctly exported.

app/client/src/pages/Editor/ActionForm/Section/index.tsx (3)

1-2: Good job with the imports!

The necessary imports for React and the CSS module are correctly included.


4-7: Well-defined interface!

The SectionProps interface is correctly defined with children and an optional isStandalone prop.


20-20: Correct export statement!

The Section component is correctly exported.

app/client/src/pages/Editor/ActionForm/Zone/styles.module.css (4)

1-6: Well-defined base styles!

The .zone class is correctly defined with grid layout and spacing.


8-10: Good implementation of double-column layout!

The double-column layout is correctly defined with a grid template of two columns.


12-14: Good implementation of single-column layout!

The single-column layout is correctly defined with a grid template of one column.


16-20: Effective use of media query!

The media query correctly collapses the double-column layout into a single column when the width is below 531px.

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, codebase verification and nitpick comments (2)
app/client/src/pages/Editor/ActionForm/Zone/index.tsx (1)

1-7: Consider adding documentation comments to the ZoneProps interface.

Adding documentation comments will improve the readability and maintainability of the code by providing context for each prop.

+ /**
+  * Props for the Zone component.
+  * @property {React.ReactNode} children - The content to be displayed within the zone.
+  * @property {"single-column" | "double-column"} [layout="single-column"] - The layout style of the zone.
+  */
interface ZoneProps {
  children: React.ReactNode;
  layout?: "single-column" | "double-column";
}
app/client/src/pages/Editor/ActionForm/Section/index.tsx (1)

1-7: Consider adding documentation comments to the SectionProps interface.

Adding documentation comments will improve the readability and maintainability of the code by providing context for each prop.

+ /**
+  * Props for the Section component.
+  * @property {React.ReactNode} children - The content to be displayed within the section.
+  * @property {boolean} [isStandalone=false] - Indicates if the section is standalone.
+  */
interface SectionProps {
  children: React.ReactNode;
  isStandalone?: boolean;
}
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d780ecb and 06a19a5.

Files selected for processing (5)
  • app/client/src/pages/Editor/ActionForm/Section/index.tsx (1 hunks)
  • app/client/src/pages/Editor/ActionForm/Section/styles.module.css (1 hunks)
  • app/client/src/pages/Editor/ActionForm/Zone/index.tsx (1 hunks)
  • app/client/src/pages/Editor/ActionForm/Zone/styles.module.css (1 hunks)
  • app/client/src/pages/Editor/ActionForm/index.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • app/client/src/pages/Editor/ActionForm/Section/styles.module.css
  • app/client/src/pages/Editor/ActionForm/index.ts
Additional comments not posted (7)
app/client/src/pages/Editor/ActionForm/Zone/index.tsx (2)

17-17: LGTM!

The export statement is correct.


9-14: Verify the usage of the data-layout attribute.

Ensure that the data-layout attribute is used consistently and correctly within the CSS and other parts of the codebase.

Verification successful

Let's correct the file type and re-run the search to verify the usage of the data-layout attribute.


The usage of the data-layout attribute is consistent and correct.

The attribute is utilized in multiple CSS files for styling and in another TypeScript file, confirming its appropriate usage.

  • app/client/src/widgets/wds/WDSTableWidget/component/TableHeader/index.tsx
  • app/client/src/widgets/wds/WDSTableWidget/component/TableHeader/styles.module.css
  • app/client/src/pages/Editor/ActionForm/Zone/styles.module.css
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `data-layout` attribute.

# Test: Search for the `data-layout` attribute usage. Expect: Consistent and correct usage.
rg --type css --type tsx 'data-layout'

Length of output: 66


Script:

#!/bin/bash
# Description: Verify the usage of the `data-layout` attribute.

# Test: Search for the `data-layout` attribute usage. Expect: Consistent and correct usage.
rg --type css --type ts 'data-layout'

Length of output: 1007

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

20-20: LGTM!

The export statement is correct.


9-18: Verify the usage of the data-standalone attribute.

Ensure that the data-standalone attribute is used consistently and correctly within the CSS and other parts of the codebase.

Verification successful

Let's correct the file type and re-run the script to ensure we capture the usage of the data-standalone attribute accurately.


The usage of the data-standalone attribute is consistent and correct.

The attribute is styled appropriately in the CSS file and applied dynamically in the Section component.

  • app/client/src/pages/Editor/ActionForm/Section/styles.module.css
  • app/client/src/pages/Editor/ActionForm/Section/index.tsx
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `data-standalone` attribute.

# Test: Search for the `data-standalone` attribute usage. Expect: Consistent and correct usage.
rg --type css --type tsx 'data-standalone'

Length of output: 70


Script:

#!/bin/bash
# Description: Verify the usage of the `data-standalone` attribute.

# Test: Search for the `data-standalone` attribute usage. Expect: Consistent and correct usage.
rg --type css --type ts 'data-standalone'

Length of output: 504

app/client/src/pages/Editor/ActionForm/Zone/styles.module.css (3)

1-6: LGTM!

The base styles for the .zone class are correct and follow best practices.


8-10: LGTM!

The styles for the double-column layout are correct and follow best practices.


12-20: LGTM!

The styles for the single-column layout and responsive behavior are correct and follow best practices.

hetunandu
hetunandu previously approved these changes Jul 31, 2024
@albinAppsmith albinAppsmith added the ok-to-test Required label for CI label Jul 31, 2024
@sagar-qa007
Copy link
Contributor

@albinAppsmith Can we also add unit test here if possible?

@albinAppsmith
Copy link
Collaborator Author

@albinAppsmith Can we also add unit test here if possible?

@sagar-qa007 This is a visual component. I feel writing unit test for this doesn't make sense.

@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 1, 2024
@albinAppsmith albinAppsmith merged commit ed1e474 into release Aug 2, 2024
42 checks passed
@albinAppsmith albinAppsmith deleted the responsive-uqi-zone branch August 2, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Responsive Zone in UQI
3 participants