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: Update JS Editor Run designs #36998

Merged
merged 12 commits into from
Oct 23, 2024
Merged

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Oct 21, 2024

Description

  • Update the JS function icon in ADS
  • Add external link icon in ADS
  • Override the Menu Title text styles

Fixes #35528
Fixes #35509
Fixes #34323
amongst other things

Automation

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

🔍 Cypress test results

Tip

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


Wed, 23 Oct 2024 06:47:16 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new JSFunctionItem component for improved dropdown functionality.
    • Added ToolbarSettingsPopover for enhanced settings management in the JSEditorToolbar.
    • New ExternalLinkIcon added to the icon library for better visual representation.
  • Improvements

    • Streamlined the JSFunctionSettings component by removing the popover functionality, making settings always visible when enabled.
    • Updated the endIcon in PluginActionSettingsPopover for a more relevant icon display.
    • Added a disabled property to the ToolbarSettingsPopover for better control over button interactivity.
  • Style Changes

    • Adjusted padding in the PluginActionForm for improved layout.
    • Added a new styled component MenuTitle for better text presentation in dropdown menus.
  • Bug Fixes

    • Removed unnecessary button click simulations in JSFunctionSettings tests to enhance test accuracy.

Copy link
Contributor

coderabbitai bot commented Oct 21, 2024

Walkthrough

The changes in this pull request involve multiple modifications across various components related to the JavaScript editor. Key updates include the introduction of a new JSFunctionItem component, enhancements to the JSFunctionRun and JSEditorToolbar components for improved interactivity, and the simplification of the JSFunctionSettings component by removing the popover functionality. Additionally, a new icon has been added to the icon provider, and styling updates have been made to enhance the visual presentation of menu items.

Changes

File Change Summary
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionRun.tsx Replaced MenuItem with JSFunctionItem, updated onFunctionSelect to use onSelect prop directly, changed startIcon.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/JSEditorToolbar.tsx Added useState for isOpen, imported ToolbarSettingsPopover, and updated rendering logic for settings popover.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx Removed ToolbarSettingsPopover, simplified rendering to always show settings UI when feature flag is enabled.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionItem.tsx Introduced new JSFunctionItem component with props for option and onSelect, encapsulating selection logic.
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx Removed button click simulations from tests, retaining checks for switch states and rendering.
app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx Updated padding from spaces-2 to spaces-4 in Flex component.
app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx Added new icon ExternalLinkIcon and updated ICON_LOOKUP mapping.
app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx Updated endIcon prop in LearnMoreLink from "share-box-line" to "external-link-line".
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/styles.ts Introduced new styled component MenuTitle with specific CSS properties.

Assessment against linked issues

Objective Addressed Explanation
Update padding for Queries & JS objects (#35509) No padding updates were made.
Update Query form configs to use the Responsive Zones and Sections (#34323) No changes related to form configs were made.

Possibly related PRs

  • fix: refactor wds menu and related components, widgets #33703: The changes in the main PR involve modifications to the JSFunctionRun component, which is related to the refactoring of menu components in this PR, indicating a connection in the context of UI component updates.
  • chore: Updating some states related to action execution #36801: The updates to the PluginActionContextProvider and PluginActionToolbar in this PR enhance the functionality of action execution, which aligns with the changes made to the JSFunctionRun component in the main PR, as both involve improvements in handling actions.
  • feat: JS Editor Toolbar #36921: The introduction of the JSEditorToolbar in the main PR directly relates to the enhancements made in the JS Editor experience, which is a focus of this PR, indicating a shared goal of improving the JavaScript editing interface.
  • chore: Add redesign for JS Editor Form #36948: The redesign of the JS Editor Form in the main PR is closely related to the updates made in this PR, as both aim to enhance the user interface and experience within the JavaScript editor context.

Suggested labels

Enhancement

Suggested reviewers

  • albinAppsmith
  • ankitakinger

🎉 In the editor's realm, changes abound,
New functions and icons, all tightly wound.
With popovers gone, simplicity reigns,
A toolbar that dances, no longer in chains.
So here's to the code, fresh and bright,
Enhancing our tools, making work light! 🎈


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between effb2cb and 41ed8e2.

📒 Files selected for processing (1)
  • app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/packages/design-system/ads/src/Icon/Icon.provider.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 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.

@hetunandu hetunandu added the ok-to-test Required label for CI label Oct 21, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Oct 21, 2024
@hetunandu hetunandu enabled auto-merge (squash) October 22, 2024 04: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: 1

🧹 Outside diff range and nitpick comments (1)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/JSEditorToolbar.tsx (1)

77-88: LGTM: Settings rendering logic improved with popover.

The use of ToolbarSettingsPopover enhances the UI and user experience. The state management and localization are implemented correctly.

Consider extracting the createMessage(JS_EDITOR_SETTINGS.TITLE) call to a constant at the top of the component for better readability and potential reuse.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1df24c6 and 0d96ee5.

📒 Files selected for processing (2)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/JSEditorToolbar.tsx (4 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.tsx (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/JSEditorToolbar.tsx (3)

1-1: LGTM: Import statements updated appropriately.

The new imports align with the component's enhanced functionality.

Also applies to: 2-2, 11-11


52-53: LGTM: State variable for popover visibility added.

The isOpen state is appropriately initialized for managing the settings popover visibility.


Line range hint 1-95: LGTM: Component structure maintained with focused improvements.

The changes enhance the settings UI while maintaining the overall component structure and feature flag logic. This approach allows for a smooth transition to the new design.

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/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (1)

3-3: LGTM. Consider adding a test for feature flag disabled state.

The removal of button click events aligns with the component's new behavior. Good job on maintaining test coverage for the existing scenarios.

Consider adding a test case to verify the component's behavior when the feature flag is disabled.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0d96ee5 and 5980f2a.

📒 Files selected for processing (4)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionItem.tsx (1 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionRun.tsx (3 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionSettings.test.tsx (1 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/styled.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/styled.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionRun.tsx
🧰 Additional context used
🔇 Additional comments (3)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionItem.tsx (3)

1-12: LGTM: Imports and component structure.

The imports are appropriate, and the component structure follows React best practices with proper TypeScript typing.


13-22: LGTM: Component logic and rendering.

The use of useCallback for memoization is a good practice. The rendering logic is clean and correctly implements the MenuItem with the provided option.


1-22: Overall assessment: Well-implemented component.

The JSFunctionItem component is concise, follows React best practices, and effectively encapsulates the functionality of rendering a menu item for a JS function. Good job on this implementation.

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/packages/design-system/ads/src/Icon/Icon.provider.tsx (1)

1067-1070: LGTM. Consider grouping related icons.

The addition of ExternalLinkIcon looks good. For better organization, consider grouping related icons together in the ICON_LOOKUP object.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between fe8ec27 and e7163a1.

⛔ Files ignored due to path filters (1)
  • app/client/packages/design-system/ads/src/__assets__/icons/ads/external-link-line.svg is excluded by !**/*.svg
📒 Files selected for processing (1)
  • app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx (3 hunks)
🧰 Additional context used
🔇 Additional comments (1)
app/client/packages/design-system/ads/src/Icon/Icon.provider.tsx (1)

1219-1219: Maintain alphabetical order in ICON_LOOKUP.

The new entry "external-link-line": ExternalLinkIcon, is correctly placed in alphabetical order. Good job maintaining the existing structure.

@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 IDE Product Issues related to the IDE Product Task A simple Todo labels Oct 23, 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 and nitpick comments (1)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/styles.ts (1)

4-9: Consider adding TypeScript types and improving CSS custom property naming.

Two suggestions for improvement:

  1. The CSS custom property --button-font-weight seems misnamed as this is a menu title component
  2. Consider adding TypeScript type definitions for the styled component
-export const MenuTitle = styled(Text)`
+export const MenuTitle = styled(Text)<{ maxWidth?: string }>`
   --menu-title-font-weight: bold;
   overflow: hidden;
   text-overflow: ellipsis;
-  max-width: 30ch;
+  max-width: ${({ maxWidth = "30ch" }) => maxWidth};
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e7163a1 and c0665bf.

📒 Files selected for processing (3)
  • app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx (1 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionItem.tsx (1 hunks)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/styles.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/JSFunctionItem.tsx
🧰 Additional context used
🔇 Additional comments (3)
app/client/src/pages/Editor/JSEditor/JSEditorToolbar/components/styles.ts (1)

6-8: LGTM: Proper text truncation implementation.

The text truncation pattern using overflow and text-overflow properties is correctly implemented.

app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.tsx (2)

Line range hint 1-105: Implementation follows best practices.

The component demonstrates clean code organization, proper hook usage, and type safety.


91-91: Icon change aligns with design system update.

The change from "share-box-line" to "external-link-line" is consistent with the PR's design system updates.

Let's verify the icon exists in the design system:

✅ Verification successful

Let me verify the icon implementation in the design system files to ensure it's properly defined.

The above script will help us see the actual implementation and confirm if the icon is properly defined in the design system. Let's examine the context around its usage to ensure it's a valid icon name.


Icon change is valid and properly defined in the design system

The "external-link-line" icon is correctly defined in both the new and old design system:

  • Imported as SVG in ads/src/Icon/Icon.provider.tsx
  • Mapped in the icon providers of both design systems
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the external-link-line icon exists in the design system
# Expected: Find references to the external-link-line icon definition

rg -l "external-link-line"

Length of output: 242


Script:

#!/bin/bash
# Check the icon implementation in the design system files
rg "external-link-line" app/client/packages/design-system/ -A 5 -B 5

Length of output: 3308

@hetunandu hetunandu merged commit 203b322 into release Oct 23, 2024
48 of 51 checks passed
@hetunandu hetunandu deleted the feat/module-instance-toolbar branch October 23, 2024 06:47
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Nov 20, 2024
## Description

- Update the icons in ADS
- Override the Menu Title text styles 



## Automation

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

### 🔍 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/11440728547>
> Commit: 1df24c6
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11440728547&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.JS`
> Spec:
> <hr>Mon, 21 Oct 2024 13:43:16 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

- **New Features**
- Introduced a new styled component, `MenuTitle`, for improved dropdown
menu item labeling.
- Enhanced the `JSFunctionRun` component with a new button icon and
improved function selection handling.

- **Bug Fixes**
- Updated the callback function to ensure it correctly responds to
changes in the `onSelect` prop.

<!-- 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 Navigation Issues/feature requests related to IDE navigation, and context switching IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo
Projects
None yet
4 participants