Update view mode toggle and add context menu for folders#1034
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📝 WalkthroughWalkthroughThis change introduces batch action support for file groups in the Changes view. Multiple components are updated to handle stage-all, unstage-all, and discard-all operations on folder groups. FolderRow gains a context menu with path-handling actions (copy path, reveal in Finder, open in editor) and expansion controls. ViewModeToggle updates its icon representation. Changes
Sequence DiagramsequenceDiagram
participant User
participant UI as FolderRow<br/>(Context Menu)
participant Handler as Batch Handler<br/>(FileListGrouped/<br/>FileListTree)
participant Files as File Operations<br/>(onStage/onUnstage<br/>/onDiscard)
User->>UI: Clicks "Stage All"
UI->>Handler: Invokes onStageAll()
Handler->>Files: Iterate files in group/node
loop For each file
Handler->>Files: Call onStage(file)
end
Files-->>Handler: Operations complete
Handler-->>UI: Update isActioning state
UI-->>User: Reflect staged state in UI
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ 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. Comment |
- Add context menu to folder rows in tree and grouped view - Support Copy Path, Copy Relative Path, Reveal in Finder, Open in Editor - Add Stage All, Unstage All, Discard All actions for folders - Extract shared usePathActions hook for FileItem and FolderRow
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/components/FolderRow/FolderRow.tsx`:
- Around line 153-249: Change the context-menu gating so batch actions remain
available even when worktreePath is unset: update the hasContextMenu predicate
to be true if any of onStageAll, onUnstageAll, or onDiscardAll exist OR if
worktreePath && folderPath !== undefined; keep path-dependent menu items (the
ContextMenuItem entries that call handleCopyPath, handleCopyRelativePath,
handleRevealInFinder, handleOpenInApp) rendered only when worktreePath (and
folderPath where needed) is present. This preserves
ContextMenu/ContextMenuTrigger usage while conditionally showing the
path-specific items inside ContextMenuContent and ensures Stage All/Unstage
All/Discard All remain accessible.
🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/components/FileList/FileListTree.tsx (1)
6-29: Reduce type duplication by reusing the shared FileTreeNode.There’s already a
FileTreeNodeinapps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/types.ts(Lines 2-13). Consider extending it here to avoid drift.♻️ Suggested refactor
-import type { ChangeCategory, ChangedFile } from "shared/changes-types"; +import type { ChangeCategory, ChangedFile } from "shared/changes-types"; +import type { FileTreeNode as BaseFileTreeNode } from "../../types"; -interface FileTreeNode { - id: string; - name: string; - type: "file" | "folder"; - path: string; - file?: ChangedFile; - children?: FileTreeNode[]; -} +interface FileTreeNode extends BaseFileTreeNode { + file?: ChangedFile; + children?: FileTreeNode[]; +}
Since the parent ChangesView guards against missing worktreePath early in render, the prop is always available when these components are mounted. Tightening the types removes unnecessary optionality.
🧹 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
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.