Skip to content

feat: Add collapsible sidebars - #111

Merged
big-guy merged 11 commits into
ness-dev:mainfrom
big-guy:tab-behavior-plus-sidebars
May 27, 2026
Merged

feat: Add collapsible sidebars#111
big-guy merged 11 commits into
ness-dev:mainfrom
big-guy:tab-behavior-plus-sidebars

Conversation

@big-guy

@big-guy big-guy commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reworks both sidebars into collapsible vertical toolbar strips and lets the workspace tab bar span the full window width. Most of the new surface lives in the collapsed state — when a sidebar is closed, its 48px strip stays useful instead of just being a stub.

Sidebars

  • Both sidebars are collapsible. When closed, each becomes a 48px vertical toolbar strip (CollapsedSidebar, CollapsedRightPanel) with the same actions as the bottom bar / panel header.
  • Single-screen mode (F12) — hides both sidebars at once. Also in the View menu.
  • Tab bar spans full window width — both sidebars are offset 40px from the top (mt-10), and the TerminalPanel tab row extends over the sidebar gutters via negative-margin tricks (topBarLeadingExtendPx, topBarTrailingExtendPx). "Harness" title is pinned at a fixed 80px from the left so it clears the traffic lights and doesn't shift when sidebars open/close. A divider separates the title from the worktree chip.
  • Sidebar header gets per-worktree controls — Clean up, Merge/Split repos (always shown, disabled when only one repo), Refresh.
  • "Add worktree" per repo — each repo group has its own entry that pre-seeds the new-worktree screen with that repo. (The single top-level + was tried and reverted.)
  • Repo worktree count swaps for an X on hover so the remove button doesn't push the layout.
  • Bottom toolbar mirrors the collapsed-sidebar order. New entry: Keyboard Shortcuts (lucide Keyboard). Report-an-issue is now MessageSquareHeart. Add repository moved here next to New project (was a WORKTREES header button).

Collapsed left strip

Status-aware group-count badges below the worktree-actions divider — Activity, ShieldAlert (needs attention, text-warning), HatGlasses (reviewing), GitPullRequest (open PRs) — hidden when zero. Clicking re-expands the sidebar.

Collapsed right strip

Full PR action stack on a worktree without expanding the panel:

  • Open PR (GitHub link).
  • Merge PR on GitHub — two-click confirm, uses the repo's preferred merge strategy, with Loader2 while merging and Check for ~4s on success. Errors surface as the tooltip + text-danger for 6s.
  • Failed-checks badge (CircleX, text-danger) — only shown when > 0.
  • Review changes (overlay).
  • Total changed files (Pencil + count, working + branch combined) and commits (GitCommitHorizontal + count; turns text-warning when there are unpushed commits, matching the BranchCommits panel).
  • Open in editor, Reveal in Finder (local backend only), fuzzy file open (Cmd+P).
  • Scratchpad (NotebookPen, below its own divider) — expands the right column and unhides the Scratchpad panel for the active repo (which defaults to hidden upstream).
  • Refresh at the bottom — re-fetches PR, changed files, and commits in one click. useWatchedQuery shares cache keys with ChangedFilesPanel / BranchCommitsPanel, so expanding/collapsing doesn't re-fetch.

Misc

  • New hotkey: toggleSingleScreen (F12). toggleRightColumn moved from Cmd+Alt+B → Cmd+Shift+B.

Test plan

  • Collapse / expand each sidebar; confirm the tab bar fills correctly in all four states (both open / left only / right only / both collapsed).
  • F12 toggles single-screen mode; View menu entry does the same.
  • Tab bar's "Harness" title stays at x=80 regardless of sidebar state.
  • Drag both ResizeHandles — both sidebars resize.
  • Open a worktree with a PR: failed-checks badge appears only when checks fail; merge button two-clicks through to a real merge via the repo's strategy.
  • Worktree with unpushed commits shows the commit badge in text-warning.
  • Scratchpad button expands right column and reveals the Scratchpad panel.
  • On a repo with one root, the Merge/Split button is disabled. Add a second repo → it enables.

Main screen
image

Collapsed
image

Single screen
image

big-guy and others added 10 commits May 27, 2026 11:59
… bar

Both sidebars and the right column now sit 40px below the top of the
window so the workspace tab bar spans the full width — title, repo
chip, tabs, and buttons are continuous from one window edge to the
other. The "Harness" title is pinned past the macOS traffic lights
and stays put when the sidebar is collapsed or expanded.

New components:
- CollapsedSidebar — 48px vertical strip with Add repo / Add worktree
  / Cleanup, then Command Center / New project / Activity / My week
  / Keyboard shortcuts / Report issue / Settings.
- CollapsedRightPanel — 48px vertical strip with Expand, Open-in-editor,
  and Reveal-in-Finder (latter hidden on remote backends).

Sidebar header restructure:
- Collapse button moved to the left of WORKTREES; Add repo / Cleanup /
  Merge-split / Refresh sit on the right with consistent button sizing.
- Merge-repos toggle always rendered, disabled when only one repo.
- Per-repo "Add worktree" entry at the top of each repo group,
  threading the repo root through so the new worktree targets that repo.
- Per-repo worktree count aligned with PR-group counts; swaps to the X
  remove button on hover (same px slot, not stacked horizontally).
- Top Command Center entry removed (still in bottom toolbar + Cmd+Shift+K).

Right column:
- Header label "TOOL PANES" in place of the prior drag-region header.
- Visibility-menu + collapse buttons resized to match the sidebar's
  WORKTREES-header buttons (size 12 icons, p-0.5, hover:bg-surface).

Single-screen mode:
- New F12 hotkey ('toggleSingleScreen' action) + View menu entry that
  hides both sidebars entirely for distraction-free terminal work.

Plumbing:
- TerminalPanel: topBarLeadingPx (fixed traffic-light clearance),
  topBarLeadingExtendPx + topBarTrailingExtendPx (negative margins so
  the tab bar visually extends to the window edges), showAppTitle.
- WorkspaceView: threads these to the top-left / top-right leaves only,
  via findTopLeftLeaf / findTopRightLeaf.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A friendlier glyph than the plain message-square chat bubble. Same icon
swap applies to both the expanded Sidebar bottom toolbar and the
CollapsedSidebar vertical strip.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Matches the divider already present under the Expand button and gives
the section a visible footer — also reserves space for follow-up
buttons (attention badges, simulate-attention) to be slotted in below
the worktree-management actions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CollapsedRightPanel grows from "expand + open-in-editor + reveal" into
a per-worktree PR action strip. From top to bottom:

  - Expand sidebar
  - (divider)
  - Open PR  — opens prStatus.url in the browser; disabled when no PR
  - Merge PR on GitHub — direct GitHub-API merge using the user's
    chosen strategy (per-repo override or global setting). Mirrors the
    two-click confirm pattern from PRStatusPanel: first click arms a
    5s timer + flips icon to text-warning; second click within the
    window calls backend.mergePR. Spins via Loader2 while in flight,
    Check + text-success briefly on success, text-danger tooltip on
    error. Disabled with a contextual reason when no PR / no token /
    PR merged or closed or draft / has conflicts.
  - Failed-checks badge (CircleX, text-danger) — only when ≥1 check
    failed; click expands the column to surface the PR Status panel.
  - (divider)
  - Review  — opens the review overlay
  - Pencil + count: changed files (working + branch)
  - GitCommitHorizontal + count: commits. Text turns text-warning when
    any commit is unpushed (matches BranchCommitsPanel's color), with
    "(unpushed)" suffix on the tooltip.
  - (divider)
  - Open worktree in editor
  - Reveal in Finder (local backend only)
  - FolderSearch2 — opens the fuzzy file picker (same as Cmd+P)
  - (flex spacer)
  - Refresh — re-fetches changed files, commits, and PR info in one
    click; icon spins while the watched queries are loading.

Counts come from useWatchedQuery on 'changedFiles' and 'branchCommits',
sharing cache keys with ChangedFilesPanel and BranchCommitsPanel so
toggling between collapsed and expanded doesn't refetch.

CollapsedSidebar gains four worktree-group count badges below the
Cleanup divider — Activity (active), ShieldAlert (needs attention,
text-warning), HatGlasses (reviewing), GitPullRequest (open PRs).
Counts derive from groupWorktrees on the live store data so they
always match the expanded sidebar's groups. Each is hidden when zero
and clicks to expand the sidebar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When the sidebars were offset 40px from the top (so the workspace
tab bar could span the full window width), the ResizeHandle on each
side got wrapped in a <div className="mt-10 shrink-0"> to carry the
margin. The wrapper became the flex item that gets stretched to row
height by the parent flex, but the ResizeHandle's inner div has no
explicit height, so it collapsed to 0px — invisible and unclickable.

Adding `flex` to each wrapper makes the ResizeHandle a flex child of
the wrapper and lets it stretch to the wrapper's height the same way
it did before the offset. No changes to the resize logic itself.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
"Squash+Merge" and "Rebase+Merge" repeat the word "merge" that's
already implied by the surrounding "Merging…" / merge-button context.
Trimming to "Squash" / "Rebase" matches GitHub's own dropdown wording
and frees up button width in the PR Status panel. "Merge" stays as-is
since it's both the strategy name and the action.

Affects the PR Status panel's merge button (PRStatusPanel) and the
collapsed right-strip merge button's tooltip (CollapsedRightPanel),
both of which share the METHOD_LABEL map.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Shorter, matches the WORKTREES header's single-word style.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sits next to "New project" in both the expanded and collapsed
sidebars — adding a repo is a rarer, app-level action like New
project, not a per-WORKTREES-header control.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds a NotebookPen button at the bottom of the collapsed
right-panel toolbar, separated from the editor/file utilities by
a divider. Clicking it expands the right column and unhides the
Scratchpad panel for the active repo (which defaults to hidden).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Aligns with upstream's icon convention (CLAUDE.md): use the rem-based
icon-* aliases instead of lucide's pixel-baked size prop so icons
scale with the uiScale setting.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@big-guy
big-guy force-pushed the tab-behavior-plus-sidebars branch from 0138100 to a4ce7ad Compare May 27, 2026 16:02
@frenchie4111 frenchie4111 added this to the v2.11.0 milestone May 27, 2026
@frenchie4111

Copy link
Copy Markdown
Collaborator

I love this - only one tiny nit from my testing:

Can you make the top margin match the side margin? seems like there are a few places this is off

image image

Other than that I am going to approve!

@frenchie4111
frenchie4111 self-requested a review May 27, 2026 20:23
Per @frenchie4111 review feedback on PR ness-dev#111: the WORKTREES /
TOOLS header rows used px-3 (12px) horizontally but only py-1.5
(6px) vertically, and the collapsed sidebar/right-panel strips
used py-1 (4px) vertically against ~11px of horizontal centering
slack. Equalizes both to py-3 (12px) so the first row sits the
same distance from the sidebar's top edge as the buttons sit
from the left edge.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@big-guy
big-guy merged commit 552e5c5 into ness-dev:main May 27, 2026
1 check passed
@big-guy
big-guy deleted the tab-behavior-plus-sidebars branch May 27, 2026 21:07
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.

2 participants