Skip to content

feat(desktop): right click on terminals to add pane - #406

Merged
AviPeltz merged 1 commit into
mainfrom
principal-partridge-851860
Dec 18, 2025
Merged

AviPeltz merged 1 commit into
mainfrom
principal-partridge-851860

Conversation

@AviPeltz

@AviPeltz AviPeltz commented Dec 18, 2025 •

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 context menu for preset and terminal controls with "Open as New Tab" and "Open as Pane in Current Tab" options.
    • Presets can now be opened as panes within the active tab for improved workspace organization.

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

@coderabbitai

coderabbitai Bot commented Dec 18, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

A new reusable PresetContextMenu component is added to provide context menu options for opening presets as new tabs or panes. The TabsView component is refactored to use this menu, and the tabs store API is extended to support optional parameters for pane creation.

Changes

Cohort / File(s) Change Summary
New PresetContextMenu Component
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx
New reusable context menu component with "Open as New Tab" and conditional "Open as Pane in Current Tab" options, optional tooltip wrapper, and callback handlers for both actions.
TabsView Integration
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
Replaces direct Button and Tooltip usage for presets with PresetContextMenu wrapper; adds handleAddPane and handleSelectPresetAsPane functions for pane creation; introduces hasActiveTab state calculations to conditionally enable menu actions; imports new PresetContextMenu component.
Tabs Store API Updates
apps/desktop/src/renderer/stores/tabs/store.ts, apps/desktop/src/renderer/stores/tabs/types.ts
Updates addPane method signature to accept optional CreatePaneOptions parameter; internal pane creation logic passes options through to underlying createPane call; interface type definition updated to reflect new signature.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • PresetContextMenu creation: Review the new component's prop handling, conditional rendering logic, and tooltip wrapper integration.
  • TabsView refactoring: Examine state calculations for hasActiveTab, handler logic for handleAddPane and handleSelectPresetAsPane, and integration of the new context menu component throughout the preset list rendering.
  • Store signature updates: Verify that addPane options are correctly threaded through and that the CreatePaneOptions type is properly defined and used.

Possibly related PRs

Poem

🐰 A menu appears with a gleeful hop,
Two paths now spring from preset's top—
Tab or pane, the choice is clear,
Our context brings options near! 🎨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is entirely empty—only the template structure remains with all sections unfilled, including no implementation details, related issues, type of change selection, testing steps, or additional context. Fill in all required sections: add a clear description of changes, link related issues, select the appropriate type of change (likely 'New feature'), document testing steps, and include any relevant notes or screenshots.
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.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main feature: enabling right-click context menu functionality on terminals to add a pane, which aligns with the core changes across the codebase.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch principal-partridge-851860

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.

@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 (2)
apps/desktop/src/renderer/stores/tabs/types.ts (1)

53-53: Type naming inconsistency between AddTabOptions and CreatePaneOptions.

The addPane method uses AddTabOptions in the interface, but the implementation in store.ts uses CreatePaneOptions (from utils.ts). Both types have identical shapes, so this works via structural typing, but consider consolidating to a single type name for clarity—perhaps PaneOptions or consistently use CreatePaneOptions throughout.

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

177-180: Consider extracting hasActiveTab to avoid repeated computation.

The hasActiveTab check is computed identically in two places. Extract it once near the other memoized values for cleaner code.

🔎 Suggested refactor
 	const { presets } = usePresets();
 	const isDark = useIsDarkTheme();
+	const hasActiveTab = !!(activeWorkspaceId && activeTabIds[activeWorkspaceId]);

 	const tabs = useMemo(

Then use hasActiveTab directly in both PresetContextMenu usages instead of the inline computation.

Also applies to: 207-209

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea23e62 and 19fd374.

📒 Files selected for processing (4)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (6 hunks)
  • apps/desktop/src/renderer/stores/tabs/store.ts (1 hunks)
  • apps/desktop/src/renderer/stores/tabs/types.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx,js,jsx}

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

For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/stores/tabs/store.ts
  • apps/desktop/src/renderer/stores/tabs/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx
apps/desktop/**/*.{ts,tsx}

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

apps/desktop/**/*.{ts,tsx}: Please 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

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/stores/tabs/store.ts
  • apps/desktop/src/renderer/stores/tabs/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for code formatting and linting, running at root level for speed

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/stores/tabs/store.ts
  • apps/desktop/src/renderer/stores/tabs/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid any type and prioritize type safety in TypeScript code

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/stores/tabs/store.ts
  • apps/desktop/src/renderer/stores/tabs/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx
**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/components/**/*.{ts,tsx}: Structure project folders as one folder per component with PascalCase naming (ComponentName/ComponentName.tsx + index.ts barrel export)
Co-locate component dependencies (utils, hooks, constants, config, tests, stories) next to the file using them
Use one component per file (no multi-component files)

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Call IPC methods from renderer process using window.ipcRenderer.invoke with type-safe object parameters

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
  • apps/desktop/src/renderer/stores/tabs/store.ts
  • apps/desktop/src/renderer/stores/tabs/types.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx
🧠 Learnings (2)
📚 Learning: 2025-12-12T05:45:09.686Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.686Z
Learning: Applies to packages/ui/**/*.{ts,tsx} : Use React + TailwindCSS v4 + shadcn/ui for UI components in `packages/ui`

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx
📚 Learning: 2025-12-12T05:45:09.686Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.686Z
Learning: Applies to apps/desktop/src/main/lib/*.ts : Implement IPC handlers accepting object parameters (not positional parameters) in apps/desktop/src/main/lib/*.ts files

Applied to files:

  • apps/desktop/src/renderer/stores/tabs/store.ts
  • apps/desktop/src/renderer/stores/tabs/types.ts
🧬 Code graph analysis (2)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (2)
apps/desktop/src/main/lib/db/schemas.ts (1)
  • TerminalPreset (99-105)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx (1)
  • PresetContextMenu (19-62)
apps/desktop/src/renderer/stores/tabs/store.ts (1)
apps/desktop/src/renderer/stores/tabs/utils.ts (2)
  • CreatePaneOptions (38-41)
  • createPane (46-62)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Deploy Admin
  • GitHub Check: Deploy API
  • GitHub Check: Deploy Docs
  • GitHub Check: Deploy Marketing
  • GitHub Check: Deploy Web
  • GitHub Check: Build
🔇 Additional comments (5)
apps/desktop/src/renderer/stores/tabs/store.ts (1)

321-326: LGTM!

The addPane method correctly accepts the optional CreatePaneOptions and propagates it to createPane. The implementation properly handles the case when the tab isn't found by returning an empty string.

apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/index.tsx (2)

65-77: LGTM!

The handleAddPane function correctly checks for an active workspace and tab, falls back to creating a new tab when appropriate, and properly calls addPane with the active tab ID.


101-118: LGTM!

The handleSelectPresetAsPane function correctly propagates preset configuration (commands and cwd) to the new pane, with appropriate fallback behavior when no active tab exists.

apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/PresetContextMenu/index.tsx (2)

1-62: Well-structured reusable component!

The PresetContextMenu component follows the coding guidelines with proper folder structure and single responsibility. The conditional tooltip wrapping and context menu options are cleanly implemented.


54-56: Verify nested asChild ref forwarding works correctly.

The nested TooltipTrigger asChild → ContextMenuTrigger asChild → children pattern should work with Radix primitives, but verify that tooltip and context menu both trigger correctly on the actual child element (e.g., buttons). If issues arise, the trigger elements may need explicit ref forwarding.

@github-actions

github-actions Bot commented Dec 18, 2025 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

Service Status
Neon Database (Neon) ✅

Thank you for your contribution! 🎉


Preview resources have been processed for cleanup

@AviPeltz
AviPeltz merged commit c117872 into main Dec 18, 2025
12 checks passed
@Kitenite
Kitenite deleted the principal-partridge-851860 branch December 18, 2025 01:43
@Kitenite Kitenite mentioned this pull request Dec 18, 2025
Kitenite pushed a commit that referenced this pull request Dec 18, 2025

This branch was previously deployed

1 inactive deployment
preview — 19fd3745 Deployed Dec 18, 2025 by AviPeltz via Deploy Admin #367
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