Skip to content

Conversation

@Shironex
Copy link
Collaborator

@Shironex Shironex commented Jan 24, 2026

Summary

Fixes #673

This PR addresses the UI/UX issue where the worktree panel becomes cluttered and messy when users have 3 or more worktrees, especially with auto-generated long branch names that cause horizontal tab wrapping.

Problem

  • Each worktree displayed as a separate tab/button in the board header
  • Auto-generated worktree names (e.g., feature/v0.14.0rc-1768981697539-gg62) are very long
  • With 3+ worktrees, tabs wrap to multiple rows, breaking the UI layout
  • Screenshot from issue shows the problem clearly

Solution

Implemented a smart layout system that:

  • Uses tab layout for 1-2 worktrees: Keeps the familiar horizontal tabs when there are few worktrees
  • Switches to dropdown layout for 3+ worktrees: Consolidates all worktrees into a compact dropdown menu

Changes Implemented

  • New WorktreeDropdown component (worktree-dropdown.tsx)

    • Single compact button showing current worktree with all status indicators
    • Dropdown menu listing all worktrees grouped by type (main branch vs feature worktrees)
    • Full integration with branch switching and action dropdowns
    • Tooltips for truncated branch names
  • New WorktreeDropdownItem component (worktree-dropdown-item.tsx)

    • Individual worktree entry in the dropdown
    • Shows selection state, running status, card count, changes, PR status, dev server, auto mode, and test status
  • New shared utilities (worktree-indicator-utils.ts)

    • truncateBranchName(): Consistent branch name truncation
    • getPRBadgeStyles(): PR badge styling by state (OPEN/MERGED/CLOSED)
    • getChangesBadgeStyles(): Uncommitted changes badge styling
    • getTestStatusStyles(): Test status indicator styling
  • Updated worktree-panel.tsx

    • Automatic layout switching based on worktree count threshold (3+)
    • Maintains full functionality in both layouts
    • Keeps existing tab layout for simple cases (1-2 worktrees)

Features Preserved in Dropdown

  • Branch name with truncation and tooltip
  • Card count badge
  • Uncommitted changes indicator
  • Dev server running indicator
  • Auto mode indicator
  • Test running/result indicator
  • PR status badge
  • Branch switching dropdown (for main branch)
  • Full actions dropdown menu

Test plan

  • Verify tab layout shows correctly with 1-2 worktrees
  • Verify dropdown layout activates with 3+ worktrees
  • Test worktree selection from dropdown
  • Verify all status indicators display correctly in both layouts
  • Test branch switching and action menus work in dropdown mode
  • Test with long auto-generated branch names
  • Verify tooltips show for truncated branch names

🤖 Generated with Claude Code

Preview

Before

image

After

image

Summary by CodeRabbit

  • New Features
    • Added a dropdown-based worktree selector for 3+ worktrees, keeping tabs for 1–2.
    • New dropdown items showing selection, running spinner, main-branch badge, and action menus (create/refresh/switch).
    • Enhanced live status indicators: PR state, test status, dev server, uncommitted changes, auto mode, and card counts.
    • Long branch names are truncated with tooltips to show full names.

✏️ Tip: You can customize this high-level summary in your review settings.

Fixes #673

When users have 3+ worktrees, especially with auto-generated long branch
names, the horizontal tab layout would wrap to multiple rows, creating
a cluttered and messy UI. This change introduces a compact dropdown menu
that automatically activates when there are 3 or more worktrees.

Changes:
- Add WorktreeDropdown component for consolidated worktree selection
- Add WorktreeDropdownItem component for individual worktree entries
- Add shared utility functions for indicator styling (PR badges, changes,
  test status) to ensure consistent appearance
- Modify worktree-panel.tsx to switch between tab layout (1-2 worktrees)
  and dropdown layout (3+ worktrees) automatically
- Truncate long branch names with tooltip showing full name
- Maintain all status indicators (dev server, auto mode, PR, changes,
  tests) in both layouts

The dropdown groups worktrees by type (main branch vs feature worktrees)
and provides full integration with branch switching and action dropdowns.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the user interface and experience of the worktree panel, particularly for users managing multiple Git worktrees. By intelligently switching between a traditional tab layout and a compact dropdown menu based on the number of active worktrees, the UI avoids visual clutter caused by numerous or long branch names. This ensures that the worktree panel remains clean, readable, and highly functional, regardless of the complexity of the user's worktree setup.

Highlights

  • Dynamic Worktree Panel UI: The worktree panel now dynamically switches between a tab layout (for 1-2 worktrees) and a dropdown layout (for 3+ worktrees) to improve UI/UX and prevent clutter from long branch names.
  • New UI Components: Introduced WorktreeDropdown and WorktreeDropdownItem components to manage the display and interaction of worktrees within the new dropdown interface.
  • Shared Utility Functions: Added worktree-indicator-utils.ts with functions for consistent branch name truncation and styling of various status badges (PR, uncommitted changes, test status) across worktree components.
  • Feature Preservation: All existing features and indicators (e.g., card count, dev server status, PR status, branch switching, actions dropdowns) are fully preserved and integrated into the new dropdown layout.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Warning

Rate limit exceeded

@Shironex has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 46 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds a new WorktreeDropdown UI with accompanying WorktreeDropdownItem and shared worktree-indicator utilities, and integrates the dropdown into the board-view worktree panel to toggle between tab and dropdown layouts for multiple worktrees.

Changes

Cohort / File(s) Summary
Dropdown components
apps/ui/src/components/views/board-view/worktree-panel/components/worktree-dropdown.tsx, apps/ui/src/components/views/board-view/worktree-panel/components/worktree-dropdown-item.tsx
New WorktreeDropdown and WorktreeDropdownItem React components with exported prop types. Provide trigger UI with truncated branch name, status indicators (dev server, tests, PR, changes, auto mode), and dropdown item rendering with selection, badges, and tooltips.
Indicator utilities
apps/ui/src/components/views/board-view/worktree-panel/components/worktree-indicator-utils.ts
New helpers: truncateBranchName, getPRBadgeStyles, getChangesBadgeStyles, getTestStatusStyles, and exported TestStatus type; map PR/test states to CSS class strings.
Module exports
apps/ui/src/components/views/board-view/worktree-panel/components/index.ts
Re-exports WorktreeDropdown, WorktreeDropdownItem, their prop types, and selected utilities/types from worktree-indicator-utils.
Integration into panel
apps/ui/src/components/views/board-view/worktree-panel/worktree-panel.tsx
Introduces WORKTREE_DROPDOWN_THRESHOLD and useDropdownLayout logic; conditionally renders WorktreeDropdown for >= threshold worktrees, wires new props/handlers for branch switching, actions, and status propagation.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant BoardView
  participant WorktreeDropdown
  participant DropdownMenu
  participant WorktreeItem
  participant ActionsDropdown
  User->>BoardView: Click worktree control
  BoardView->>WorktreeDropdown: open dropdown (props, selected worktree)
  WorktreeDropdown->>DropdownMenu: render items (main + others)
  DropdownMenu->>WorktreeItem: render WorktreeDropdownItem per worktree
  User->>WorktreeItem: select item
  WorktreeItem->>WorktreeDropdown: onSelect -> onSwitchBranch / handlers
  User->>WorktreeItem: open item actions
  WorktreeItem->>ActionsDropdown: open actions -> execute action (create/switch/refresh)
  ActionsDropdown->>WorktreeDropdown: notify action result
  WorktreeDropdown->>BoardView: propagate selection/status changes
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

Enhancement

"I hopped through branches, tidy and spry,
Little spinner whiskers and badges nearby,
Names trimmed neatly, no clutter in sight,
A compact dropdown to set things right. 🐇"

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a dropdown UI component for worktree selection when there are multiple worktrees, which directly addresses the linked issue #673.
Linked Issues check ✅ Passed The PR fully implements the objectives from issue #673: switches to dropdown layout for 3+ worktrees, preserves all existing functionality and indicators, and maintains tab layout for 1-2 worktrees as expected.
Out of Scope Changes check ✅ Passed All changes are within scope: new dropdown components, utilities for styling/truncation, and integration into worktree-panel.tsx follow directly from issue #673 requirements with no unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Shironex Shironex self-assigned this Jan 24, 2026
@Shironex Shironex added the scope: ui UI/UX changes, layout, visual or interaction behavior. label Jan 24, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new WorktreeDropdown component and its related sub-components (WorktreeDropdownItem, worktree-indicator-utils) to enhance the user interface for managing multiple worktrees. The WorktreePanel now dynamically switches between a tab-based layout and the new dropdown layout when there are three or more worktrees, preventing horizontal tab wrapping. The WorktreeDropdown displays the selected worktree with various status indicators (e.g., running, dev server, tests, uncommitted changes, PR status) and integrates branch switching and worktree actions. A review comment suggests refactoring the hardcoded threshold of 3 for activating the dropdown layout into a named constant for better readability and future configurability.

@Shironex Shironex added Do Not Merge Use this label if something should not be merged. Work-In-Progress Currently being addressed. labels Jan 24, 2026
…shold

- Added a constant `WORKTREE_DROPDOWN_THRESHOLD` to define the threshold for switching from tabs to dropdown layout in the WorktreePanel.
- Updated the logic to use this constant for better readability and maintainability of the code.
@Shironex Shironex added Ready-To-Merge A feature or bug has been improved/fixed and a final review is requested before merging. and removed Work-In-Progress Currently being addressed. Do Not Merge Use this label if something should not be merged. labels Jan 24, 2026
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

🤖 Fix all issues with AI agents
In
`@apps/ui/src/components/views/board-view/worktree-panel/components/worktree-dropdown-item.tsx`:
- Around line 86-90: The DropdownMenuItem currently uses onClick which breaks
keyboard activation; update the component so it uses Radix's onSelect instead of
onClick (or attach the same handler to onSelect) on the DropdownMenuItem element
(the one with className using cn and aria-current) so keyboard Enter/Space
triggers the same onSelect handler as mouse clicks; ensure you remove/replace
the onClick prop and keep existing className and aria-current behavior.

@Shironex Shironex merged commit a4c43b9 into v0.14.0rc Jan 24, 2026
6 checks passed
@Shironex Shironex deleted the feature/bug-improve-the-worktree-ui-79ph branch January 24, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready-To-Merge A feature or bug has been improved/fixed and a final review is requested before merging. scope: ui UI/UX changes, layout, visual or interaction behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants