Skip to content

fix(sidebar): add context menu to channels widget, remove draggable#2128

Merged
sedson merged 3 commits intomainfrom
seamus/no-drag-sidebar-links
Mar 23, 2026
Merged

fix(sidebar): add context menu to channels widget, remove draggable#2128
sedson merged 3 commits intomainfrom
seamus/no-drag-sidebar-links

Conversation

@sedson
Copy link
Copy Markdown
Contributor

@sedson sedson commented Mar 23, 2026

  • fix(sidebar): add draggable=false
  • add split-bases context menu to chanels sidebar widget

@sedson sedson requested a review from a team as a code owner March 23, 2026 18:29
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Walkthrough

The sidebar channel row now wraps each channel button in a Kobalte ContextMenu. A shared content() object standardizes split-opening parameters. New helpers — openInCurrentSplit(), openInNewSplit() (checks canAppendSplit()), and openFullscreen() — control split behavior; the primary click handler uses preferNewSplit for Shift-clicks. The context menu exposes: "Open in new split" (disabled when append not allowed), "Open fullscreen", and "Open in current split". Buttons are set draggable={false}.

Poem

🐇 I hopped to a row and found a trick,
A menu tucked where clicks stick,
Splits unfold or shine so bright,
Shift to spread, or keep in sight,
A little rabbit cheers the tweak —
Sidebar sprouts a clever beak!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: adding a context menu to the channels widget and removing the draggable attribute.
Description check ✅ Passed The description relates to the changeset, covering the two main aspects: adding draggable=false and adding a split-based context menu to the channels widget.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch seamus/no-drag-sidebar-links

Comment @coderabbitai help to get the list of available commands and usage tips.

@sedson sedson changed the title seamus/no drag sidebar links fix(sidebar): add context menu to channels widget, remove draggable Mar 23, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between fc38a71 and 202bf12.

📒 Files selected for processing (1)
  • js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx

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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 202bf12 and c761faa.

📒 Files selected for processing (1)
  • js/app/packages/app/component/app-sidebar/channels-unread-widget.tsx

Comment on lines +165 to +173
onClick={(e) => {
// Middle mouse handling
if (e.button === 1) return;

e.preventDefault();
layout.openWithSplit(content(), {
preferNewSplit: e.shiftKey,
referredFrom: 'sidebar',
});
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.

🧹 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.

Suggested change
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.

@sedson sedson merged commit 56cb45d into main Mar 23, 2026
25 checks passed
@sedson sedson deleted the seamus/no-drag-sidebar-links branch March 23, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant