fix(sidebar): add context menu to channels widget, remove draggable#2128
fix(sidebar): add context menu to channels widget, remove draggable#2128
Conversation
sedson
commented
Mar 23, 2026
- fix(sidebar): add draggable=false
- add split-bases context menu to chanels sidebar widget
WalkthroughThe sidebar channel row now wraps each channel button in a Kobalte ContextMenu. A shared Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx`:
- Around line 126-127: The helper canOpenInNewSplit currently returns true when
globalSplitManager() is missing, enabling a no-op "Open in new split" action;
change canOpenInNewSplit to return false if globalSplitManager() is undefined so
the UI disables the action when the split manager isn't available. Update any
other similar checks (the early-return branch that checks globalSplitManager()
near the other usages and the action handler at the "open in new split" call
site) to rely on canOpenInNewSplit so the button is disabled and the handler is
not invoked when no split manager exists.
- Around line 129-133: The primary-click open flow is missing the referral
metadata; ensure all calls that open the item use the same referredFrom value by
adding referredFrom: 'sidebar' to the open invocation(s). Specifically, update
the primary-click/open path that currently calls layout.open (or
layout.openWithSplit without the metadata) and the handler around content() so
that the calls (e.g., openInCurrentSplit, layout.openWithSplit and any direct
layout.open calls used in the primary-click branch at lines referenced) pass {
referredFrom: 'sidebar' } to preserve consistent source attribution.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 01ae3ff0-11f3-4c9d-9d8c-07ec3eb76e08
📒 Files selected for processing (1)
js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx
js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx`:
- Around line 165-173: The onClick handler directly calls
layout.openWithSplit(content(), { preferNewSplit: e.shiftKey, referredFrom:
'sidebar' }) which duplicates options used elsewhere; extract a single helper
(e.g., openContentWithSplit or layout.openWithSplitWithDefaults) that accepts
the content() and an event/overrides, centralizes the default options
(preferNewSplit: derived from event.shiftKey, referredFrom: 'sidebar') and use
that helper in this onClick (and any other callers) so the split-opening
metadata is defined in one place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 33d7d39f-0299-4197-ac47-899c1413abc2
📒 Files selected for processing (1)
js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx
| onClick={(e) => { | ||
| // Middle mouse handling | ||
| if (e.button === 1) return; | ||
|
|
||
| e.preventDefault(); | ||
| layout.openWithSplit(content(), { | ||
| preferNewSplit: e.shiftKey, | ||
| referredFrom: 'sidebar', | ||
| }); |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider centralizing openWithSplit options to prevent future drift.
The primary click path duplicates options already represented in helper logic. A single helper for layout.openWithSplit(...) would reduce metadata divergence risk.
♻️ Proposed refactor
+ const openWithSidebarSource = (preferNewSplit = false) =>
+ layout.openWithSplit(content(), {
+ preferNewSplit,
+ referredFrom: 'sidebar',
+ });
const openInCurrentSplit = () =>
- layout.openWithSplit(content(), {
- referredFrom: 'sidebar',
- });
+ openWithSidebarSource(false);
const openFullscreen = () => {
const split = openInCurrentSplit();
split?.toggleSpotlight(true);
};
@@
onClick={(e) => {
// Middle mouse handling
if (e.button === 1) return;
e.preventDefault();
- layout.openWithSplit(content(), {
- preferNewSplit: e.shiftKey,
- referredFrom: 'sidebar',
- });
+ openWithSidebarSource(e.shiftKey);
}}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| onClick={(e) => { | |
| // Middle mouse handling | |
| if (e.button === 1) return; | |
| e.preventDefault(); | |
| layout.openWithSplit(content(), { | |
| preferNewSplit: e.shiftKey, | |
| referredFrom: 'sidebar', | |
| }); | |
| const openWithSidebarSource = (preferNewSplit = false) => | |
| layout.openWithSplit(content(), { | |
| preferNewSplit, | |
| referredFrom: 'sidebar', | |
| }); | |
| const openInCurrentSplit = () => | |
| openWithSidebarSource(false); | |
| const openFullscreen = () => { | |
| const split = openInCurrentSplit(); | |
| split?.toggleSpotlight(true); | |
| }; | |
| // ... other code ... | |
| onClick={(e) => { | |
| // Middle mouse handling | |
| if (e.button === 1) return; | |
| e.preventDefault(); | |
| openWithSidebarSource(e.shiftKey); | |
| }} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx` around
lines 165 - 173, The onClick handler directly calls
layout.openWithSplit(content(), { preferNewSplit: e.shiftKey, referredFrom:
'sidebar' }) which duplicates options used elsewhere; extract a single helper
(e.g., openContentWithSplit or layout.openWithSplitWithDefaults) that accepts
the content() and an event/overrides, centralizes the default options
(preferNewSplit: derived from event.shiftKey, referredFrom: 'sidebar') and use
that helper in this onClick (and any other callers) so the split-opening
metadata is defined in one place.