Skip to content

Update bridge preview chevron design #37

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alecande11
Copy link
Contributor

@alecande11 alecande11 commented Jun 30, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a custom toggle button for showing or hiding detailed operations, featuring dynamic icons and labels.
  • Style

    • Enhanced visual styling for toggle controls and operation items, including updated backgrounds, hover effects, and button appearances.
  • Bug Fixes

    • Improved interactivity by making the chevron icon clickable only when appropriate, ensuring a more intuitive user experience.

@alecande11 alecande11 requested a review from simcheolhwan as a code owner June 30, 2025 11:24
Copy link

coderabbitai bot commented Jun 30, 2025

Walkthrough

A new toggle button with custom styling was introduced to control the display of detailed operations, replacing a previous checkbox-based control. The interactivity and appearance of operation items were refined, including changes to CSS for hover states and button backgrounds. The OperationItem component now conditionally supports an onClick handler.

Changes

File(s) Change Summary
.../BridgePreviewRoute.module.css Added .toggle class for new toggle button styling.
.../BridgePreviewRoute.tsx Replaced CheckboxButton with a custom button for toggling details; updated icons and conditional click handling logic.
.../OperationItem.module.css Updated background, hover, and cursor styles for .arrow .type and button.type.
.../OperationItem.tsx Added optional onClick prop; made chevron button interactive only when type is falsy; updated Props interface.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BridgePreviewRoute
    participant OperationItem

    User->>BridgePreviewRoute: Clicks toggle button
    BridgePreviewRoute->>BridgePreviewRoute: Toggle showDetails state
    BridgePreviewRoute->>OperationItem: Passes onClick handler to last item (if details hidden)
    User->>OperationItem: Clicks chevron (if interactive)
    OperationItem->>BridgePreviewRoute: Triggers toggle to show details
Loading

Poem

A toggle anew, with a button so neat,
Hops in with icons—what a treat!
Details now hidden, now shown with a click,
Operation chevrons, interactive and slick.
With styles refreshed, the UI feels bright—
A bunny’s delight, all toggled just right! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

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.

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: 1

🧹 Nitpick comments (1)
packages/widget-react/src/pages/bridge/BridgePreviewRoute.tsx (1)

143-143: Document the conditional interaction model.

The conditional onClick handler creates an interesting UX pattern where the chevron is only clickable when details are hidden. This provides multiple ways to show details but centralizes the hide action to the main toggle.

Consider adding a comment to document this intentional design decision for future maintainers.

+        {/* Chevron only clickable when details hidden - provides alternative way to expand */}
         <OperationItem {...lastOperationProps} onClick={showAll ? undefined : toggleShowAll} />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e06be4e and d292424.

📒 Files selected for processing (4)
  • packages/widget-react/src/pages/bridge/BridgePreviewRoute.module.css (1 hunks)
  • packages/widget-react/src/pages/bridge/BridgePreviewRoute.tsx (3 hunks)
  • packages/widget-react/src/pages/bridge/OperationItem.module.css (1 hunks)
  • packages/widget-react/src/pages/bridge/OperationItem.tsx (3 hunks)
🔇 Additional comments (5)
packages/widget-react/src/pages/bridge/BridgePreviewRoute.module.css (1)

6-19: LGTM! Clean toggle button styling.

The new .toggle class implementation follows good CSS practices with consistent use of custom properties, appropriate hover states, and flexible layout. The styling aligns well with the overall design system.

packages/widget-react/src/pages/bridge/OperationItem.module.css (1)

32-48: Good visual distinction for interactive vs non-interactive states.

The CSS changes effectively differentiate between interactive and non-interactive arrow elements:

  • Non-interactive .type (span): --gray-8 background with hover color effect
  • Interactive button.type: --border background for better clickability indication

This provides clear visual feedback to users about which elements are interactive.

packages/widget-react/src/pages/bridge/BridgePreviewRoute.tsx (1)

5-5: Import changes look correct.

The new icon imports (IconList, IconMinus) properly support the updated toggle button functionality.

packages/widget-react/src/pages/bridge/OperationItem.tsx (2)

19-19: Proper addition of optional onClick prop.

The onClick prop is correctly typed as optional and properly integrated into the component interface.

Also applies to: 78-78


28-38: Excellent conditional rendering for interactive states.

The logic properly handles the two interaction modes:

  • When type is present: non-interactive <span> with tooltip for operation type information
  • When type is absent: interactive <button> with onClick handler for expanding details

This creates a clean separation between informational and interactive states, working seamlessly with the parent component's conditional logic.

Comment on lines +114 to 125
<button className={styles.toggle} onClick={toggleShowAll}>
{showAll ? (
<>
<IconMinus size={12} /> Hide detail
</>
) : (
<>
<IconList size={12} /> Show detail
</>
)}
</button>
</Collapsible.Trigger>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add accessibility attributes to the toggle button.

The toggle button implementation is functionally correct but could benefit from accessibility improvements for screen readers.

-          <button className={styles.toggle} onClick={toggleShowAll}>
+          <button 
+            className={styles.toggle} 
+            onClick={toggleShowAll}
+            aria-expanded={showAll}
+            aria-label={showAll ? "Hide operation details" : "Show operation details"}
+          >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<button className={styles.toggle} onClick={toggleShowAll}>
{showAll ? (
<>
<IconMinus size={12} /> Hide detail
</>
) : (
<>
<IconList size={12} /> Show detail
</>
)}
</button>
</Collapsible.Trigger>
<button
className={styles.toggle}
onClick={toggleShowAll}
aria-expanded={showAll}
aria-label={showAll ? "Hide operation details" : "Show operation details"}
>
{showAll ? (
<>
<IconMinus size={12} /> Hide detail
</>
) : (
<>
<IconList size={12} /> Show detail
</>
)}
</button>
</Collapsible.Trigger>
🤖 Prompt for AI Agents
In packages/widget-react/src/pages/bridge/BridgePreviewRoute.tsx around lines
114 to 125, the toggle button lacks accessibility attributes. Add appropriate
ARIA attributes such as aria-expanded to indicate the toggle state and
aria-controls to reference the collapsible content it controls. This will
improve screen reader support and make the button's purpose and state clear to
all users.

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