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: Updating List item and List components in ADS to start using it in Entity explorer #38344

Merged
merged 10 commits into from
Dec 30, 2024

Conversation

ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Dec 24, 2024

Description

Under Entity explorer modularisation, we are updating the List item and List components in ADS which will eventually be getting used in Entity explorer to show the entity items. This change makes sure current usages of this component doesn't break.

Fixes #37620

Automation

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

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12517459729
Commit: e1601a6
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Sanity/Datasources/MockDBs_Spec.ts
List of identified flaky tests.
Fri, 27 Dec 2024 17:09:22 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a flexible rightControl property for list items, enhancing interactivity.
    • Added rightControlVisibility property to manage control visibility based on hover state.
    • Implemented a new customTitleComponent property for additional customization options.
  • Bug Fixes

    • Adjusted rendering logic for descriptions in list items to improve clarity.
  • Style

    • Enhanced styling for list items, including new padding and border-radius adjustments.
    • Updated CSS selectors for improved specificity in list item styling.
  • Documentation

    • Updated component stories to reflect new properties and improved API clarity.

Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

Walkthrough

This pull request introduces significant modifications to the List component within the design system. The changes primarily focus on replacing the endIcon property with a more flexible rightControl feature, enhancing the component's configurability. The updates span multiple files, including stories, styles, types, and the main component implementation. Additionally, a minor adjustment to the ApiMethodIcon in the Explorer icons is included, slightly modifying its default dimensions.

Changes

File Change Summary
.../List/List.stories.tsx Updated story imports, replaced endIcon with rightControl, added rightControlVisibility
.../List/List.styles.tsx Introduced RightControlWrapper, updated StyledListItem with new props and styling
.../List/List.tsx Removed endIcon, added rightControl and rightControlVisibility props
.../List/List.types.tsx Modified ListItemProps interface, added rightControl, rightControlVisibility, and customTitleComponent
.../Explorer/ExplorerIcons.tsx Adjusted ApiMethodIcon default height and width
.../Editor/IDE/EditorPane/Query/hooks.tsx Renamed wrapperClassName to className in useAddQueryListItems hook
.../Editor/IDE/EditorPane/JS/Add.tsx Renamed wrapperClassName to className in getListItems function
.../Editor/IDE/EditorPane/components/Group.tsx Updated CSS selectors for list items in StyledList

Assessment against linked issues

Objective Addressed Explanation
rightControl prop implementation (#37620)
rightControlVisibility prop implementation (#37620)
Removal of endIcon prop (#37620)
Update description and descriptionType to optional (#37620)
Support for onClick functionality (#37620) onClick prop is not mentioned in the changes.

Possibly related PRs

Suggested labels

Enhancement

Suggested reviewers

  • sagar-qa007
  • albinAppsmith
  • hetunandu

Poem

🎨 List components dance and sway,
Right controls now have their day!
Flexibility blooms like spring's first flower,
Icons and buttons gain new power!
Code evolves with elegant might 🚀


📜 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 efbca95 and e1601a6.

📒 Files selected for processing (1)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx

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
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 24, 2024
Copy link

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

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 (10)
app/client/packages/design-system/ads/src/List/List.types.tsx (2)

9-10: Consider renaming for clarity.

“rightControl” is concise, but “endControl” or “actions” might better convey its purpose if it typically contains actions like icons or buttons.


11-12: Add JSDoc description.

The rightControlVisibility property should include a more descriptive JSDoc comment that clarifies its role in controlling visibility.

app/client/packages/design-system/ads/src/List/List.styles.tsx (4)

51-56: Use consistent control toggle.

Hiding the RightControlWrapper on hover is elegant, but confirm all pointer events still work seamlessly, especially for screen readers.


61-63: Active state styling.

Check if the active state complements the final design. Sometimes an even darker shade clarifies active feedback.


65-67: Selected state.

Reusing active-bg for selected state can be confusing. Consider a distinct color or style for persistent selection.


110-116: RightControlWrapper usage.

This container is a valid approach for grouping interactive elements on the right side. Ensure clickable regions have adequate a11y attributes if needed.

app/client/src/pages/Editor/Explorer/Actions/ActionEntity.tsx (2)

24-24: Clean code preference.

Commented-out import suggests the code was deprecated. Remove these lines if they're fully obsolete.


29-35: Remove stale code.

These commented-out functions indicate a change in approach for updating action names. Delete them if they're not needed.

app/client/packages/design-system/ads/src/List/List.tsx (1)

129-136: Descriptive text usage.

Displaying title via TextWithTooltip is great. Confirm large titles are truncated gracefully.

app/client/packages/design-system/ads/src/List/List.stories.tsx (1)

164-165: Good use of the new hover-based visibility.
Ensure that the hover interaction is clearly documented so users understand how the control rendering toggles.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 16953b8 and 3ccf437.

📒 Files selected for processing (6)
  • app/client/packages/design-system/ads/src/List/List.stories.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx (3 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (3 hunks)
  • app/client/packages/design-system/ads/src/List/List.types.tsx (2 hunks)
  • app/client/src/pages/Editor/Explorer/Actions/ActionEntity.tsx (3 hunks)
  • app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx (1 hunks)
🔇 Additional comments (25)
app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx (1)

269-270: Confirm that the new icon dimensions uphold the intended design.

The default height and width have been slightly reduced from 18px→16px and 36px→34px, respectively. Please ensure this aligns with design and layout requirements across the application.

app/client/packages/design-system/ads/src/List/List.types.tsx (2)

26-26: Good choice making description optional.

This makes the component more flexible for items without a description.


30-30: Consistent naming recommendation.

With descriptionType now optional, ensure conditioning logic consistently checks for undefined before usage.

app/client/packages/design-system/ads/src/List/List.styles.tsx (7)

39-41: Enhanced flexibility with typed prop.

Extending Wrapper to accept rightControlVisibility is a neat way to handle hover-based displays.


48-50: Ensure consistent sizing.

Adjusting the border-radius and min-height is fine, but confirm these changes match the rest of the design system’s guidelines for list items.


57-59: Hover color alignment.

This hover color is consistent with the design system’s hover states. Nice job!


69-74: Disabled overrides.

The reduced opacity and not-allowed cursor are standard patterns, which is good. Verify that hover or focus states don’t override them.


76-81: Focus outline clarity.

Ensuring a clear, accessible focus outline is essential. Great to see these focus-visible rules.


129-132: Spacing changes.

Adjusting padding and gap looks fine, but double-check it aligns with other design system components for seamless consistency.


159-159: Line-height update.

Increasing line-height improves readability; ensure it doesn’t break layout for multiline descriptions.

app/client/src/pages/Editor/Explorer/Actions/ActionEntity.tsx (3)

3-3: Import retention confirmation.

Confirm you still need EntityClassNames. If not, removing it will keep code tidy.


27-27: Align import sources.

Importing ListItem from "@appsmith/ads" is consistent with the new approach. Good job.


113-120: Variadic props usage.

Using the ListItem with rightControl and rightControlVisibility is consistent with the new design. Confirm the class name “action t--action-entity” remains relevant under new styling.

app/client/packages/design-system/ads/src/List/List.tsx (9)

8-8: Check import usage.

The newly added import for RightControlWrapper must match references in the file to avoid potential bundling issues.


87-88: Increased customizability.

Introducing rightControl and rightControlVisibility is a flexible alternative to a single endIcon. Good approach!


113-119: Proper data attributes.

Using data-disabled and data-selected is a clean way to handle styling states. Confirm that UI test frameworks reference these accurately.


127-128: Named handler.

Separating the click and keydown handlers fosters clarity. The inline arrow function is short and fine here.


138-140: Color usage for errors.

Using a direct CSS variable for error color is straightforward and consistent with the system.


146-147: Block vs inline logic.

Ensuring the block description is only rendered if it exists is correct. Great clarity in condition usage.


148-155: Inline description usage.

Similarly, this condition ensures inline descriptions are only displayed if present, which is clean and robust.


156-156: Fallback check.

rightControl presence is neatly handled with a short conditional. No complaints here.


158-159: Right control wrapper.

Logic is straightforward: if rightControl is defined, wrap it. This approach fosters modularity.

app/client/packages/design-system/ads/src/List/List.stories.tsx (3)

2-2: Great addition of the Button import.
It appears you’re utilizing the Button component for the right control. No concerns here.


82-86: Good introduction of the rightControl property.
The ReactNode type choice makes it suitably flexible for various controls.


217-224: Nice addition of the ListItemRightControlStory.
Your new story is consistent with the updated API, providing a clear example of using Button as the right control element.

Copy link

Deploy-Preview-URL: https://ce-38344.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: 0

🧹 Nitpick comments (1)
app/client/packages/design-system/ads/src/List/List.stories.tsx (1)

82-96: Consider grouping related props together

The customTitleComponent prop should be grouped with other visual/layout props like title and startIcon for better organization of the API documentation.

Also applies to: 149-156

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3ccf437 and 924ae26.

📒 Files selected for processing (3)
  • app/client/packages/design-system/ads/src/List/List.stories.tsx (5 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.types.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/packages/design-system/ads/src/List/List.types.tsx
🔇 Additional comments (6)
app/client/packages/design-system/ads/src/List/List.tsx (4)

8-8: LGTM: Import addition for RightControlWrapper


87-88: LGTM: Props update for enhanced control flexibility

The replacement of endIcon with rightControl and rightControlVisibility provides better flexibility for list item controls.


113-119: LGTM: Enhanced wrapper attributes for better state management

Good addition of data attributes for disabled and selected states, along with rightControlVisibility prop.


162-164: LGTM: Clean implementation of rightControl rendering

app/client/packages/design-system/ads/src/List/List.stories.tsx (2)

2-2: LGTM: Import addition for Button component


173-173: LGTM: Comprehensive story examples for rightControl usage

Good examples showing both simple icon and button usage in rightControl.

Also applies to: 225-232

@ankitakinger ankitakinger changed the title chore: updating list item and list components in ADS chore: Updating List item and List components in ADS to start using it in Entity explorer Dec 27, 2024
@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 Dec 27, 2024
@ankitakinger ankitakinger added the ok-to-test Required label for CI label Dec 27, 2024
@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

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

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

🧹 Nitpick comments (2)
app/client/packages/design-system/ads/src/List/List.styles.tsx (1)

39-91: LGTM with minor type safety enhancement

The StyledListItem implementation looks good with proper styling variables and accessibility considerations.

Consider using a literal type for rightControlVisibility instead of string:

-  rightControlVisibility?: "hover" | "always";
+  rightControlVisibility?: RightControlVisibility;
+type RightControlVisibility = "hover" | "always";
app/client/packages/design-system/ads/src/List/List.tsx (1)

Line range hint 87-92: Props update looks good

The transition from endIcon to rightControl provides more flexibility.

Consider adding JSDoc comments to document the new props:

/** Content to be rendered in the right control area */
rightControl?: React.ReactNode;
/** Controls the visibility behavior of the right control. Default: "always" */
rightControlVisibility?: "hover" | "always";
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 924ae26 and 1a18d43.

📒 Files selected for processing (2)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (4 hunks)
🔇 Additional comments (4)
app/client/packages/design-system/ads/src/List/List.styles.tsx (2)

Line range hint 94-113: Clean implementation

The wrapper components are well-structured with appropriate flex layout properties.


114-117: LGTM

Simple and focused implementation for the right control container.

app/client/packages/design-system/ads/src/List/List.tsx (2)

113-121: Well-structured with proper accessibility

Good implementation with appropriate data attributes and keyboard navigation support.


162-164: Clean implementation

Straightforward conditional rendering of the right control content.

@ankitakinger ankitakinger added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 27, 2024
Copy link

Deploy-Preview-URL: https://ce-38344.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: 0

🧹 Nitpick comments (2)
app/client/packages/design-system/ads/src/List/List.styles.tsx (1)

Line range hint 54-89: LGTM with a minor suggestion for line height consistency

The layout improvements look good. However, there's an inconsistency in line height values - some use pixels (16px) while others use normal.

Consider standardizing line heights:

-    line-height: 16px;
+    line-height: normal;
app/client/packages/design-system/ads/src/List/List.tsx (1)

Line range hint 122-165: Consider extracting description rendering logic

The content rendering logic is getting complex. Consider extracting the description rendering into separate components for better maintainability.

Example structure:

const BlockDescription = ({ description }: { description: string }) => (
  <TextWithTooltip
    className={ListItemBDescClassName}
    color="var(--ads-v2-color-fg-muted)"
    isMultiline
    kind="body-s"
  >
    {description}
  </TextWithTooltip>
);

const InlineDescription = ({ description }: { description: string }) => (
  <TextWithTooltip
    className={ListItemIDescClassName}
    color="var(--ads-v2-color-fg-muted)"
    kind="body-s"
  >
    {description}
  </TextWithTooltip>
);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1a18d43 and 8f55f31.

📒 Files selected for processing (2)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (4 hunks)
🔇 Additional comments (4)
app/client/packages/design-system/ads/src/List/List.styles.tsx (2)

91-99: LGTM! Well-structured list container

The flex layout with proper spacing and overflow handling is well implemented.


Line range hint 101-159: LGTM! Excellent implementation of data attributes

The component follows best practices by:

  • Using data attributes for conditional styling
  • Implementing proper focus management
  • Handling hover/active states cleanly
app/client/packages/design-system/ads/src/List/List.tsx (2)

87-88: LGTM! Good replacement for endIcon

The rightControl prop provides more flexibility than the previous endIcon implementation.


113-121: LGTM! Well-structured list item implementation

Good implementation of data attributes and accessibility features.

hetunandu
hetunandu previously approved these changes Dec 27, 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

🧹 Nitpick comments (3)
app/client/src/pages/Editor/IDE/EditorPane/components/Group.tsx (2)

18-18: Keep an eye on accessibility for invisible elements.
Opacity set to 0 might make descriptions inaccessible to screen readers. Consider visually hiding these elements in a more accessible manner if required.


22-22: Ensure a suitable fallback for non-hover devices.
Relying on :hover may degrade user experience on touchscreens. Consider a different approach for mobile use cases.

app/client/packages/design-system/ads/src/List/List.tsx (1)

121-121: Rethink clickable non-button elements.
If this wrapper acts like a button, consider <button> or appropriate ARIA roles for better accessibility.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8f55f31 and efbca95.

📒 Files selected for processing (6)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.types.tsx (2 hunks)
  • app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/components/Group.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx
  • app/client/packages/design-system/ads/src/List/List.types.tsx
🔇 Additional comments (8)
app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx (1)

51-51: Check for legacy references to wrapperClassName.

It looks good that you've updated wrapperClassName to the standard React className property. However, ensure that no existing code references the old property.

You can run the following script to identify any residual references:

app/client/packages/design-system/ads/src/List/List.tsx (7)

9-9: Good addition for the new rightControl approach.
This import neatly supports the shift from endIcon to a flexible rightControl.


86-87: rightControl and rightControlVisibility are a nice enhancement.
Replacing the old endIcon with these props increases versatility. Great work.


112-120: Consider aligning data attributes with accessibility requirements.
Using data- attributes for styling is fine, but confirm if you need ARIA attributes or roles for better screen reader compatibility.


125-126: Retaining startIcon is fine.
No issues spotted: it aligns with existing patterns without conflict.


158-159: No concerns on bracket closure changes.
Everything appears consistent here.


160-161: Optional right control is handled cleanly.
Conditionally rendering rightControl is a good approach for flexibility.


163-163: Closing tag update is straightforward.
No issues found.

@hetunandu hetunandu self-requested a review December 30, 2024 05:36
@hetunandu hetunandu merged commit 2246bde into release Dec 30, 2024
89 of 92 checks passed
@hetunandu hetunandu deleted the chore/entity-list-item branch December 30, 2024 05:37
@coderabbitai coderabbitai bot mentioned this pull request Dec 31, 2024
2 tasks
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.

Update the List Item ADS component to Entity List item
2 participants