Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.
Use the checkboxes below for quick actions:
- ▶️ Resume reviews
- 🔍 Trigger review
Walkthrough
Adds a cross-platform context menu: Electron main IPC handler and preload bridge, contract/type additions, web fallback UI, and web UI + store updates to show a thread context menu and delete threads when "Delete" is selected.
Changes
| Cohort / File(s) | Summary |
|---|---|
Desktop main & preload apps/desktop/src/main.ts, apps/desktop/src/preload.ts | Add CONTEXT_MENU_CHANNEL ("desktop:context-menu") and import Menu in main; handle IPC invoke by building a native Menu, showing a popup, and resolving selected id or null. Expose showContextMenu(items) on desktopBridge in preload. |
Shared contract types packages/contracts/src/ipc.ts | Extend NativeApi with `contextMenu.show(items: readonly { id: T; label: string }[], position?: { x: number; y: number }) => Promise<T |
Web bridge, fallback & types apps/web/src/wsNativeApi.ts, apps/web/src/contextMenuFallback.ts, apps/web/src/vite-env.d.ts | Add api.contextMenu.show which calls window.desktopBridge.showContextMenu(items) when available, otherwise uses showContextMenuFallback(items, position). Implement DOM fallback showContextMenuFallback and add showContextMenu to DesktopBridge types. |
Web UI & state apps/web/src/components/Sidebar.tsx, apps/web/src/store.ts | Wire onContextMenu on thread items to call contextMenu.show; handle selection of "Delete" by stopping active session (if any) and dispatching DELETE_THREAD. Add DELETE_THREAD action and reducer case to remove the thread and adjust activeThreadId. |
Manifest package.json | Minor package manifest edits (small line changes). |
Sequence Diagram(s)
| 1 | sequenceDiagram |
| 2 | participant User |
| 3 | participant Sidebar as "Web UI (Sidebar)" |
| 4 | participant API as "NativeApi / Bridge" |
| 5 | participant Main as "Electron Main" |
| 6 | participant Store as "App Store" |
| 7 | |
| 8 | User->>Sidebar: Right-click thread (x,y) |
| 9 | Sidebar->>API: contextMenu.show(items, position) |
| 10 | alt Desktop bridge available |
| 11 | API->>Main: IPC invoke "desktop:context-menu" with items |
| 12 | Main->>Main: Build native Menu and popup at focused window |
| 13 | User->>Main: Select option or dismiss |
| 14 | Main-->>API: Resolve selected item id or null |
| 15 | else Web fallback |
| 16 | API->>API: showContextMenuFallback(items, position) |
| 17 | User->>API: Select option or dismiss |
| 18 | API-->>Sidebar: Resolve selected item id or null |
| 19 | end |
| 20 | Sidebar->>Sidebar: If selected "Delete": stop session (if any) |
| 21 | Sidebar->>Store: Dispatch DELETE_THREAD(threadId) |
| 22 | Store->>Store: Remove thread, reassign activeThreadId if needed |
| 23 | Store-->>Sidebar: Updated state |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'Add native context menu to delete threads' directly and accurately reflects the main change: introducing a native context menu feature for deleting threads in the sidebar. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
juliusmarminge/sidebar-delete-thread
Comment @coderabbitai help to get the list of available commands and usage tips.