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

context menu on ebios rm valid step/unvalid step #1211

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

melinoix
Copy link
Contributor

@melinoix melinoix commented Dec 19, 2024

Created a context menu (click right) on ebios rm valid step/unvalid step to validate it on UI with a green check or Unvalid it to have a checklist icon.

Summary by CodeRabbit

  • New Features

    • Added context menu functionality for step management
    • Introduced new localization keys for marking items as valid or not valid in English and French
  • Dependencies

    • Added bits-ui package to project dependencies
  • Localization

    • Updated English and French translation files with new status-related keys

Copy link

coderabbitai bot commented Jan 22, 2025

Walkthrough

The pull request introduces localization updates for English and French languages, adding new translation keys for marking items as valid or not valid. Additionally, the frontend package now includes the bits-ui library, and the Tile.svelte component has been enhanced with a context menu functionality. These changes improve the user interface by providing more interactive options for managing step statuses in the application.

Changes

File Change Summary
frontend/messages/en.json Added translation keys markAsValid and markAsNotValid
frontend/messages/fr.json Added French translations for markAsValid and markAsNotValid
frontend/package.json Added bits-ui dependency (version ^0.22.0)
frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/Tile.svelte Introduced context menu with openMenuIndex variable

Sequence Diagram

sequenceDiagram
    participant User
    participant Tile
    participant ContextMenu
    participant Backend

    User->>Tile: Interact with step
    Tile->>ContextMenu: Open context menu
    User->>ContextMenu: Select status change
    ContextMenu->>Backend: Submit status update
    Backend-->>Tile: Update confirmation
    Tile->>Tile: Update local step status
Loading

Poem

🐰 A rabbit's tale of UI delight,
Context menus now shine so bright!
With bits-ui we dance and play,
Marking steps in a brand new way 🎉
Localized and smooth as can be!


🪧 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.

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.

@melinoix melinoix marked this pull request as ready for review January 22, 2025 10:20
Copy link

@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)
frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/Tile.svelte (1)

165-187: Consider enhancing the status update UX

While the implementation is functional, consider these improvements for better user experience:

  1. Add loading state during submission
  2. Show error feedback to users when the update fails
 on:click={async () => {
+  let isLoading = true;
   const newStatus = step.status === 'done' ? 'in_progress' : 'done';
   const formData = new FormData();
   formData.append('workshop', workshop.toString());
   formData.append('step', (i + 1).toString());
   formData.append('status', newStatus);

   // Submit the data to the backend
   const response = await fetch(
     `/ebios-rm/${$page.params.id}?/changeStepState`,
     {
       method: 'POST',
       body: formData
     }
   );

   // Handle success or error
   if (response.ok) {
     step.status = newStatus; // Update the local state
   } else {
+    // Show error toast/notification
+    const error = await response.text();
+    console.error('Failed to update step state:', error);
   }
+  isLoading = false;
 }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59a651b and 124b7bd.

⛔ Files ignored due to path filters (1)
  • frontend/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • frontend/messages/en.json (1 hunks)
  • frontend/messages/fr.json (1 hunks)
  • frontend/package.json (1 hunks)
  • frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/Tile.svelte (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: startup-functional-test (3.12)
  • GitHub Check: startup-docker-compose-test
  • GitHub Check: enterprise-startup-functional-test (3.12)
  • GitHub Check: enterprise-functional-tests (3.12, chromium)
  • GitHub Check: enterprise-startup-docker-compose-test
  • GitHub Check: functional-tests (3.12, chromium)
🔇 Additional comments (6)
frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/Tile.svelte (3)

5-5: Clean implementation of context menu state management!

The ContextMenu import and openMenuIndex state variable are well-structured and properly typed.

Also applies to: 18-18


62-65: Well-structured context menu implementation!

The ContextMenu.Root setup with controlled state management via openMenuIndex follows best practices.


161-162: Clean and accessible context menu styling!

The styling implementation:

  • Uses semantic color classes
  • Has proper transitions
  • Maintains good contrast ratios
frontend/package.json (1)

85-85: Good choice of UI library!

The bits-ui library is a solid choice for context menus, and the version is appropriately pinned with ^ to allow minor updates while avoiding breaking changes.

frontend/messages/en.json (1)

999-1000: Clear and consistent translations!

The new translation keys follow the existing patterns and clearly describe their purpose.

frontend/messages/fr.json (1)

990-991: Well-localized French translations!

The French translations are natural and maintain semantic consistency with their English counterparts.

@nas-tabchiche nas-tabchiche marked this pull request as draft January 22, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant