Skip to content

feat: add widgets sidebar toggle button to view menu#3140

Merged
sawka merged 5 commits intowavetermdev:mainfrom
mswiszcz:feat/sidebar-toggle
Mar 31, 2026
Merged

feat: add widgets sidebar toggle button to view menu#3140
sawka merged 5 commits intowavetermdev:mainfrom
mswiszcz:feat/sidebar-toggle

Conversation

@mswiszcz
Copy link
Copy Markdown
Contributor

Add ability to toggle the Widgets sidebar visibility via a button in the tabbar. State persists across sessions and workspaces through workspace metadata (layout:widgetsvisible).

Add ability to toggle the Widgets sidebar visibility via a button in the
tabbar. State persists across sessions and workspaces through workspace
metadata (layout:widgetsvisible).
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 27, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

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 resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This change adds a new metadata key "layout:widgetsvisible" used to control the widgets sidebar visibility. Backend: new constant and an optional pointer field on workspace meta to represent the value. Types: updated global MetaType to include the new key. Frontend: WorkspaceLayoutModel exposes a jotai atom initialized from workspace meta (default true), the workspace component reads this atom to conditionally mount <Widgets />, and the application menu gains a “Toggle Widgets Bar” action that flips the metadata via RPC.

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 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
Description check ✅ Passed The description is directly related to the changeset, accurately summarizing the feature (toggle widgets sidebar) and persistence mechanism (workspace metadata).
Title check ✅ Passed The title accurately describes the main change: adding a widgets sidebar toggle to the view menu, which is confirmed by the emain-menu.ts changes and overall PR objectives.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Mar 27, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 2
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
frontend/app/workspace/workspace-layout-model.ts 75 Missing setter - the derived atom has no write functionality
frontend/app/tab/tabbar.tsx N/A Toggle button removed - widgets sidebar cannot be toggled via UI
New Changes (commit d15a05a..HEAD)

Added "Toggle Widgets Bar" menu item in View menu (emain/emain-menu.ts:315-327). This provides an alternative way to toggle the widgets sidebar via keyboard shortcut (Cmd+Shift+? > Toggle Widgets Bar). The implementation correctly uses fireAndForget pattern and meta key "layout:widgetsvisible".

Other Observations (not in diff)

The menu approach provides a workaround for toggling the widgets bar, but the underlying issue remains: the derived atom at line 75 in workspace-layout-model.ts has no setter, preventing programmatic updates from the frontend.

Files Reviewed (2 files)
  • emain/emain-menu.ts - 1 new change (valid implementation)
  • frontend/app/workspace/workspace-layout-model.ts - 1 issue (unchanged)
  • frontend/app/tab/tabbar.tsx - 1 issue (unchanged)

Reviewed by minimax-m2.5-20260211 · 2,230,012 tokens


Reviewed by minimax-m2.5-20260211 · 286,672 tokens

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 `@frontend/app/workspace/workspace-layout-model.ts`:
- Around line 173-177: The widgets visibility is only read at construction in
initializeFromMeta(), so WorkspaceLayoutModel's
widgetsSidebarVisible/widgetsSidebarVisibleAtom can retain the previous
workspace value; extract the savedWidgetsSidebarVisible load into a small method
(e.g., reloadWidgetsVisibility) that reads
globalStore.get(this.getWidgetsSidebarVisibleAtom()), sets
this.widgetsSidebarVisible and globalStore.set(this.widgetsSidebarVisibleAtom,
...), and call that method both from initializeFromMeta() and whenever the
active workspace changes (or from the existing workspace-switch handler) so the
per-workspace value is reloaded on workspace switches.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d00a0da6-63f0-475a-986a-6388c88e2c67

📥 Commits

Reviewing files that changed from the base of the PR and between 96c2526 and 337ca7f.

📒 Files selected for processing (6)
  • frontend/app/tab/tabbar.tsx
  • frontend/app/workspace/workspace-layout-model.ts
  • frontend/app/workspace/workspace.tsx
  • frontend/types/gotypes.d.ts
  • pkg/waveobj/metaconsts.go
  • pkg/waveobj/wtypemeta.go

mswiszcz and others added 3 commits March 27, 2026 23:39
…pace bleed

The widgetsSidebarVisible state was only loaded once at construction time
via initializeFromMeta(). Since WorkspaceLayoutModel is a singleton,
switching workspaces would keep the previous workspace's value. Replace
the local boolean + PrimitiveAtom with a derived atom that reads directly
from workspace meta, eliminating the duplicated state entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL: Toggle button removed - widgets sidebar cannot be toggled

The WidgetsSidebarButton component that was previously in frontend/app/tab/tabbar.tsx has been removed. The PR description states "Add ability to toggle the Widgets sidebar visibility via a button in the tabbar," but the button was removed in commit d15a05ac. Without a toggle mechanism, users have no way to show/hide the widgets sidebar, making the feature non-functional.

this.vtabWidth = VTabBar_DefaultWidth;
this.vtabVisible = false;
this.panelVisibleAtom = jotai.atom(false);
this.widgetsSidebarVisibleAtom = jotai.atom(
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.

CRITICAL: Missing setter - the derived atom has no write functionality

The widgetsSidebarVisibleAtom is now a derived read-only atom (no getter/setter pair). There is no way to update the value. Compare with how panelVisibleAtom works in this file - it has a setter method setAIPanelVisible() that updates the atom and persists to meta. The widgets sidebar needs similar setter functionality to persist visibility changes to layout:widgetsvisible.

@sawka sawka changed the title feat: add widgets sidebar toggle button to tabbar feat: add widgets sidebar toggle button to view menu Mar 31, 2026
@sawka sawka merged commit bda8421 into wavetermdev:main Mar 31, 2026
3 of 4 checks passed
suruoxi pushed a commit to suruoxi/waveterm that referenced this pull request Apr 1, 2026
Add ability to toggle the Widgets sidebar visibility via a button in the
tabbar. State persists across sessions and workspaces through workspace
metadata (layout:widgetsvisible).

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: sawka <mike@commandline.dev>
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.

3 participants