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

fix(ui): close for successful submission and no params message #713

Merged
merged 5 commits into from
Dec 19, 2024

Conversation

billcookie
Copy link
Contributor

@billcookie billcookie commented Dec 18, 2024

Overview

Small UI improves for the right panel node params.

What I've done

  • Right Panel now closes after successful submission
  • No parameter messages added if there are no parameters for a node e.g. echoSink. Note, etc

What I haven't done

How I tested

Manually

Screenshot

Which point I want you to review particularly

Memo

Summary by CodeRabbit

Release Notes

  • New Features

    • Simplified display in the ParamEditor component, now showing "No Parameters Available" when no parameters exist.
  • Bug Fixes

    • Enhanced control flow for closing the RightPanel and submitting parameters.
  • Localization Updates

    • Updated translations across English, Spanish, French, Japanese, and Chinese localization files, replacing "Node data" with "No Parameters Available" and adding new terms for improved clarity.

Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

Walkthrough

The pull request introduces modifications to the UI components and localization files, focusing on simplifying the ParamEditor component and updating internationalization support. The changes streamline the parameter editing interface by removing unused UI elements, adding a "No Parameters Available" message, and updating localization files across multiple languages to reflect these modifications.

Changes

File Change Summary
ui/src/features/Editor/components/RightPanel/components/ParamEditor/index.tsx Removed UI components from @flow/components, simplified parameter display, added conditional rendering for "No Parameters Available"
ui/src/features/Editor/components/RightPanel/index.tsx Updated event handling, introduced handleClose and handleParamsSubmit functions, modified panel closing and submission logic
ui/src/lib/i18n/locales/en.json Updated localization to replace "Node data" with "No Parameters Available"
ui/src/lib/i18n/locales/es.json Updated localization to replace "Node data" with "No Parameters Available" and added new translation placeholders
ui/src/lib/i18n/locales/fr.json Updated localization to replace "Node data" with "No Parameters Available" and added new translation placeholders
ui/src/lib/i18n/locales/ja.json Updated localization to replace "Node data" with "No Parameters Available"
ui/src/lib/i18n/locales/zh.json Updated localization to replace "Node data" with "No Parameters Available" and added new translation placeholders

Suggested reviewers

  • KaWaite

Possibly related PRs

Poem

🐰 Params dancing light and free,
No more clutter, just clarity!
Locales singing a new refrain,
Simplicity is our rabbit's gain!
UI magic, clean and bright! 🌟


📜 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 54cd225 and b8de345.

📒 Files selected for processing (1)
  • ui/src/features/Editor/components/RightPanel/index.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ui/src/features/Editor/components/RightPanel/index.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.

Copy link

netlify bot commented Dec 18, 2024

Deploy Preview for reearth-flow ready!

Name Link
🔨 Latest commit b8de345
🔍 Latest deploy log https://app.netlify.com/sites/reearth-flow/deploys/67638431417fee000854109c
😎 Deploy Preview https://deploy-preview-713--reearth-flow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@billcookie billcookie marked this pull request as ready for review December 19, 2024 02:15
@billcookie billcookie requested a review from KaWaite as a code owner December 19, 2024 02:15
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 comments (1)
ui/src/lib/i18n/locales/fr.json (1)

Line range hint 60-60: Missing French translations for new UI elements.

The following keys have been added without French translations:

  • "General shortcuts"
  • "Manage Projects"
  • "Trigger1"

This could impact the user experience for French users. Please provide appropriate translations for these UI elements.

Suggested translations:

-  "General shortcuts": "",
+  "General shortcuts": "Raccourcis généraux",
-  "Manage Projects": "",
+  "Manage Projects": "Gérer les projets",
-  "Trigger1": "",
+  "Trigger1": "Déclencheur1"

Also applies to: 89-89, 123-123

🧹 Nitpick comments (5)
ui/src/features/Editor/components/RightPanel/components/ParamEditor/index.tsx (1)

49-51: Consider improving accessibility for the Parameters section

The parameters section could benefit from proper ARIA attributes and heading structure.

Consider this improvement:

-        <div className="flex flex-col gap-2">
-          <p className="text-lg dark:font-thin">{t("Parameters")}</p>
-        </div>
+        <div className="flex flex-col gap-2" role="region" aria-label={t("Parameters")}>
+          <h2 className="text-lg dark:font-thin">{t("Parameters")}</h2>
+        </div>
ui/src/features/Editor/components/RightPanel/index.tsx (2)

Line range hint 17-24: Consider making the click event dispatch more robust

While the current implementation works, the click event dispatch could be more robust.

Consider this improvement:

  const closePanel = useCallback(() => {
    const paneElement = document.getElementsByClassName("react-flow__pane")[0];
    if (!paneElement) return;
-   const clickEvent = new Event("click", { bubbles: true, cancelable: true });
+   const clickEvent = new MouseEvent("click", {
+     bubbles: true,
+     cancelable: true,
+     view: window,
+     detail: 1
+   });
    paneElement.dispatchEvent(clickEvent);
  }, []);

26-32: Consider simplifying the Promise handling

The Promise.resolve wrap might be unnecessary if onParamsSubmit is already returning a Promise.

Consider this simplification if onParamsSubmit is async:

  const handleParamsSubmit = useCallback(
    async (nodeId: string, data: any) => {
-     await Promise.resolve(onParamsSubmit(nodeId, data));
+     await onParamsSubmit(nodeId, data);
      closePanel();
    },
    [onParamsSubmit, closePanel],
  );
ui/src/lib/i18n/locales/es.json (1)

Line range hint 12-14: Complete missing translations

Several new UI strings have empty translations which may affect Spanish users:

  • "3D visualization is not supported in this browser"
  • "2D"
  • "3D"
  • "Choose action"
  • "Subworkflow Node"
  • "General shortcuts"
  • "Manage Projects"
  • "Ran by:"
  • "Trigger1"

Consider adding appropriate Spanish translations for these strings.

Also applies to: 44-44, 47-47, 62-62, 102-102, 125-125, 134-134

ui/src/lib/i18n/locales/zh.json (1)

Line range hint 47-47: Complete missing translations

The following UI strings have empty translations which may affect Chinese users:

  • "Subworkflow Node"
  • "Manage Projects"
  • "Trigger1"

Consider adding appropriate Chinese translations for these strings.

Also applies to: 102-102, 134-134

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 49c73aa and 54cd225.

📒 Files selected for processing (7)
  • ui/src/features/Editor/components/RightPanel/components/ParamEditor/index.tsx (4 hunks)
  • ui/src/features/Editor/components/RightPanel/index.tsx (5 hunks)
  • ui/src/lib/i18n/locales/en.json (1 hunks)
  • ui/src/lib/i18n/locales/es.json (1 hunks)
  • ui/src/lib/i18n/locales/fr.json (1 hunks)
  • ui/src/lib/i18n/locales/ja.json (1 hunks)
  • ui/src/lib/i18n/locales/zh.json (1 hunks)
🔇 Additional comments (7)
ui/src/lib/i18n/locales/en.json (1)

53-53: LGTM! Translation addition aligns with PR objectives

The new translation entry for "No Parameters Available" is properly formatted and consistent with other entries.

ui/src/features/Editor/components/RightPanel/components/ParamEditor/index.tsx (1)

Line range hint 58-64: LGTM! Conditional rendering implementation

The implementation of the "No Parameters Available" message and conditional form rendering is clean and aligns with the PR objectives.

ui/src/features/Editor/components/RightPanel/index.tsx (1)

48-48: LGTM! Implementation aligns with PR objectives

The changes successfully implement the requirement to close the panel after successful submission. The code is well-documented and the implementation is clean.

Also applies to: 67-67

ui/src/lib/i18n/locales/es.json (1)

53-53: LGTM: Parameter message translation is complete

The Spanish translation for "No Parameters Available" is properly implemented as "No hay parámetros disponibles", which aligns with the PR objectives.

ui/src/lib/i18n/locales/ja.json (1)

53-53: LGTM: Parameter message translation is complete

The Japanese translation for "No Parameters Available" is properly implemented as "利用可能なパラメータはありません", which aligns with the PR objectives.

ui/src/lib/i18n/locales/zh.json (1)

53-53: LGTM: Parameter message translation is complete

The Chinese translation for "No Parameters Available" is properly implemented as "没有可用参数", which aligns with the PR objectives.

ui/src/lib/i18n/locales/fr.json (1)

53-53: LGTM: Clear and accurate French translation for the "No Parameters Available" message.

The translation "Aucun paramètre disponible" is grammatically correct and naturally conveys the intended meaning in French.

Comment on lines +52 to +54
{/* <TabsTrigger className="flex-1" value="data">
{t("Node data")}
</TabsTrigger>
</TabsList>
</TabsTrigger> */}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove commented out code

Instead of keeping commented code, it should be removed as it can be retrieved from version control if needed in the future. This improves code maintainability and readability.

Also applies to: 68-88

const handleClick = useCallback((e: MouseEvent) => {
e.stopPropagation();

const closePanel = useCallback(() => {
Copy link
Member

@KaWaite KaWaite Dec 19, 2024

Choose a reason for hiding this comment

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

handlePanelClose

@billcookie billcookie merged commit 5fd42be into main Dec 19, 2024
18 checks passed
@billcookie billcookie deleted the ui/node-parameters-improvements branch December 19, 2024 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants