Repository navigation
refactor (desktop): open button and + add repository copy & icon - #597
Conversation
📝 WalkthroughWalkthroughRefactored 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
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 includesopenInAppobject reference.The
openInAppmutation object is included in the dependency array, which is technically correct for accessingisPending. However, tRPC mutation objects have stable references, so this should work fine. Just note that if you only needisPending, 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 mainAPP_OPTIONSandVSCODE_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
📒 Files selected for processing (5)
apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsxapps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsxapps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsxapps/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 insrc/lib/trpc
Use alias as defined intsconfig.jsonwhen 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/observableinstead of async generators, as the library explicitly checksisObservable(result)and throws an error otherwise
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsxapps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsxapps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsxapps/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 usinganytype - 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.tsxapps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsxapps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsxapps/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.tsxapps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsxapps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsxapps/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.tsxapps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsxapps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsxapps/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.tsxapps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsxapps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsxapps/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:fixorbiome check --write
Files:
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceSidebarFooter.tsxapps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsxapps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsxapps/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.tsxapps/desktop/src/renderer/screens/main/components/TopBar/index.tsxapps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/WorkspaceControls.tsxapps/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
OpenInMenuButtontoTopBar.apps/desktop/src/renderer/screens/main/components/TopBar/index.tsx (1)
35-40: LGTM!Good placement for
OpenInMenuButtonin the TopBar. The conditional check onworktreePathensures the button only appears when relevant, and the optionalbranchprop is correctly sourced fromworktree?.branch.apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx (1)
25-27: LGTM!Prop usage correctly aligned with the updated
WorkspaceControlsinterface afterworktreePathremoval.apps/desktop/src/renderer/screens/main/components/TopBar/WorkspaceControls/OpenInMenuButton.tsx (3)
35-38: Good use of memoization.Wrapping with
memois appropriate here sinceTopBarmay 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] truncateapplied, 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.
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
New Features
UI Updates
✏️ Tip: You can customize this high-level summary in your review settings.