Skip to content

refactor (desktop): open button and + add repository copy & icon - #597

Merged
AviPeltz merged 1 commit into
mainfrom
open-button
Jan 5, 2026
Merged

AviPeltz merged 1 commit into
mainfrom
open-button

Conversation

@AviPeltz

@AviPeltz AviPeltz commented Jan 5, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • New Features

    • Added branch information display in the "Open in" menu
  • UI Updates

    • Changed "Add project" button to "Add repository" with updated icon
    • Enhanced styling and visual polish with improved icon sizing, tooltip positioning, and interactive states
    • Refined keyboard shortcut visibility in dropdown menus

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

@coderabbitai

coderabbitai Bot commented Jan 5, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Refactored OpenInMenuButton with memoization, hooks, and branch support. Relocated its rendering from WorkspaceControls to TopBar. Simplified WorkspaceControls by removing worktreePath prop. Updated WorkspaceSidebarFooter button text and icon.

Changes

Cohort / File(s) Summary
OpenInMenuButton Enhancement
apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
Added optional branch prop; wrapped component in memo; added memoized hooks (useMemo for currentApp, useCallback for handlers); extended query usage with staleTime; replaced direct isLoading check with derived state from mutations; updated UI to conditionally render branch information; updated styling, icon sizes, tooltip offsets, and dropdown dimensions; improved accessibility (empty alt attributes); refactored dropdown items to conditionally show keyboard shortcuts.
Component Hierarchy Reorganization
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx, apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
Moved OpenInMenuButton rendering from WorkspaceControls to TopBar (conditional on worktreePath availability); removed worktreePath prop from WorkspaceControls interface and component signature; updated ContentView to pass only workspaceId to WorkspaceControls.
UI Text and Icon Update
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
Replaced folder-plus icon with folder-open icon; updated button text from "Add project" to "Add repository".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • CharlieHelps

Poem

🐰 A button hops from workspace deep,
To topbar's place, with branch to keep,
With memo's guard and hooks so neat,
The refactor's dance, now bold and sweet!
🌟✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description follows the template structure but lacks substantive details. Only the Type of Change checkbox was filled (Refactor); Description, Related Issues, Testing, Screenshots, and Additional Notes sections remain empty or contain only template comments. Fill in the Description section with details about the refactoring changes, link any related issues, and describe testing performed to validate the changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the main changes: refactoring the open button and updating the add repository copy and icon.
✨ Finishing touches
  • 📝 Generate docstrings

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.

@AviPeltz
AviPeltz marked this pull request as ready for review January 5, 2026 22:08
@AviPeltz
AviPeltz merged commit 2ac6ed0 into main Jan 5, 2026
4 of 5 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (3)
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx (1)

57-58: Terminology inconsistency with toast messages.

The button text changed to "Add repository" but the toast messages in handleOpenNewProject (lines 18, 24, 31, 34-37, 41) still reference "project" (e.g., "Failed to open project", "Opening project...", "Project opened"). Consider updating these messages for consistency, or this could be intentional if "project" is the internal domain term.

apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx (2)

60-63: Dependency array includes openInApp object reference.

The openInApp mutation object is included in the dependency array, which is technically correct for accessing isPending. However, tRPC mutation objects have stable references, so this should work fine. Just note that if you only need isPending, you could destructure it to be more explicit.


204-217: JetBrains submenu missing shortcut display.

The JetBrains submenu items don't display keyboard shortcuts when the item matches lastUsedApp, unlike the main APP_OPTIONS and VSCODE_OPTIONS. This appears to be an oversight for consistency.

🔎 Proposed fix to add shortcut display
 {JETBRAINS_OPTIONS.map((app) => (
   <DropdownMenuItem
     key={app.id}
     onClick={() => handleOpenInOtherApp(app.id)}
   >
     <img
       src={app.icon}
       alt=""
       className="size-4 object-contain mr-2"
     />
     {app.label}
+    {app.id === lastUsedApp && showOpenInShortcut && (
+      <DropdownMenuShortcut>
+        {openInShortcut}
+      </DropdownMenuShortcut>
+    )}
   </DropdownMenuItem>
 ))}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7af6330 and a22be67.

📒 Files selected for processing (5)
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc
Use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.
For tRPC subscriptions with trpc-electron, ALWAYS use the observable pattern from @trpc/server/observable instead of async generators, as the library explicitly checks isObservable(result) and throws an error otherwise

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use object parameters for functions with 2+ parameters instead of positional arguments
Functions with 2+ parameters should accept a single params object with named properties for self-documentation and extensibility
Use prefixed console logging with context pattern: [domain/operation] message
Extract magic numbers and hardcoded values to named constants at module top
Use lookup objects/maps instead of repeated if (type === ...) conditionals
Avoid using any type - maintain type safety in TypeScript code
Never swallow errors silently - at minimum log them with context
Import from concrete files directly when possible - avoid barrel file abuse that creates circular dependencies
Avoid deep nesting (4+ levels) - use early returns, extract functions, and invert conditions
Use named properties in options objects instead of boolean parameters to avoid boolean blindness

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never import Node.js modules (fs, path, os, net) in renderer process or shared code - they are externalized for browser compatibility

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

One component per file - do not create multi-component files

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
apps/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Drizzle ORM for all database operations - never use raw SQL

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for formatting and linting - run at root level with bun run lint:fix or biome check --write

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
🧠 Learnings (1)
📚 Learning: 2026-01-02T06:50:28.671Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T06:50:28.671Z
Learning: Applies to apps/*/src/components/{ui,ai-elements,react-flow}/*.tsx : Use kebab-case single files for shadcn/ui components (e.g., button.tsx, base-node.tsx) in src/components/ui/, src/components/ai-elements, and src/components/react-flow/

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx
  • apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx
🧬 Code graph analysis (3)
apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx (1)
apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx (1)
  • OpenInMenuButton (35-231)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx (1)
apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx (1)
  • WorkspaceControls (7-15)
apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx (1)
apps/desktop/src/renderer/stores/hotkeys/store.ts (1)
  • useHotkeyText (208-217)
🔇 Additional comments (6)
apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsx (1)

7-8: LGTM!

Clean simplification. The early return pattern and single-prop interface make this component more focused after relocating OpenInMenuButton to TopBar.

apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx (1)

35-40: LGTM!

Good placement for OpenInMenuButton in the TopBar. The conditional check on worktreePath ensures the button only appears when relevant, and the optional branch prop is correctly sourced from worktree?.branch.

apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx (1)

25-27: LGTM!

Prop usage correctly aligned with the updated WorkspaceControls interface after worktreePath removal.

apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx (3)

35-38: Good use of memoization.

Wrapping with memo is appropriate here since TopBar may re-render on workspace changes while the props (worktreePath, branch) remain stable.


96-106: Consider branch truncation edge case.

The branch name has max-w-[140px] truncate applied, which is good for long branch names. However, the leading / is rendered inside the truncated span, so very long branch names would show /very-long-bran... which looks correct.


185-189: Consistent shortcut display logic.

Good consistency showing the keyboard shortcut only for the last-used app across all menu sections. The VS Code submenu correctly implements the same pattern as the main APP_OPTIONS.

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

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