Skip to content

Update view mode toggle and add context menu for folders#1034

Merged
Kitenite merged 5 commits into
mainfrom
kiet-ho/context-menu-on-folders
Jan 28, 2026
Merged

Update view mode toggle and add context menu for folders#1034
Kitenite merged 5 commits into
mainfrom
kiet-ho/context-menu-on-folders

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 28, 2026

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

    • Batch operations for folders: Stage All, Unstage All, and Discard All actions to manage multiple files at once.
    • Context menu for folders with actions: Copy Path, Copy Relative Path, Reveal in Finder, and Open in Editor.
  • Improvements

    • Enhanced folder row UI with collapsible headers and expansion indicators for better visual hierarchy.
    • Updated grouped view mode icon for improved clarity.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 28, 2026

Warning

Rate limit exceeded

@Kitenite has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 39 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.

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Batch Operations in List Components
FileListGrouped.tsx, FileListTree.tsx
Introduces batch action handlers (handleStageAll, handleUnstageAll, handleDiscardAll) that traverse files in a group/node and invoke corresponding callbacks. Adds collectFilesFromNode utility in FileListTree for recursive file collection. Wires batch-action props to FolderRow.
FolderRow Context Menu & Path Handling
FolderRow.tsx
Adds Collapsible and ContextMenu UI with 7 actions (Copy Path, Copy Relative Path, Reveal in Finder, Open in Editor, Stage All, Unstage All, Discard All). Introduces path computation logic and electronTrpc mutations for Finder/Editor operations. Extends props to accept folderPath, worktreePath, batch handlers, and isActioning.
Icon Toggle Update
ViewModeToggle.tsx
Replaces LuFolder icon with LuList for grouped view mode; LuFolderTree remains for tree mode.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 Files gathered in groups so neat,
With batch commands, the work's complete!
Stage all, unstage, discard with flair,
Paths revealed with context care.
Git workflows hop along with cheer! 🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is entirely empty—only the template comments remain with no actual content filled in across any required sections. Fill in all required sections: provide a clear description of changes, link related issues, specify the type of change, describe testing steps, and add any additional context.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately captures both main changes: updating the view mode toggle icon and adding context menu functionality to folder rows.

✏️ 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.

- 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
Copy link
Copy Markdown
Contributor

@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/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 FileTreeNode in apps/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.
@Kitenite Kitenite merged commit dd6fda5 into main Jan 28, 2026
5 checks passed
@github-actions
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! 🎉

@Kitenite Kitenite deleted the kiet-ho/context-menu-on-folders branch January 28, 2026 18:00
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