Skip to content

Collapse all button for projects sidebar#2308

Open
kyziq wants to merge 5 commits into
pingdotgg:mainfrom
kyziq:feat/sidebar-collapse-all-projects
Open

Collapse all button for projects sidebar#2308
kyziq wants to merge 5 commits into
pingdotgg:mainfrom
kyziq:feat/sidebar-collapse-all-projects

Conversation

@kyziq
Copy link
Copy Markdown

@kyziq kyziq commented Apr 23, 2026

What Changed

  • Added "Collapse all" button (ChevronsDownUpIcon) to the Projects section header, alongside the existing sort and add-project buttons
  • Button hidden when no projects exist
  • Button disabled (dimmed) when all projects are already collapsed — visual feedback that the action is a no-op
  • New pure function collapseAllProjects(state, projectIds[]) in uiStateStore — only targets currently visible projects, not stale state entries
  • No-op guard returns same state reference when nothing changes, preventing unnecessary re-renders
  • Three unit tests covering collapse behavior and no-op case

Why

With multiple projects open in the sidebar, collapsing each one individually is tedious. This adds a single-click way to reset the sidebar to a clean state.

UI Changes

Screenshots

Before After
Before After

No project

Will not show the button
CleanShot 2026-04-23 at 23 02 15@2x

Video

Zen.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Closes #2306


Note

Low Risk
Low risk UI/state change limited to toggling projectExpandedById for visible sidebar projects; main risk is minor UX/state regressions around grouped project keys or expansion defaults.

Overview
Adds a “Collapse all” control to the Projects sidebar header that collapses every currently listed project, hides itself when there are no projects, and disables itself when everything is already collapsed.

Introduces a collapseAllProjects action in uiStateStore (with a no-op return when state is unchanged) and wires it through Sidebar.tsx, along with unit tests covering the collapse, non-target, and no-op cases.

Reviewed by Cursor Bugbot for commit 82362d4. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

[!NOTE]

Add 'Collapse all' button to the projects sidebar

  • Adds a collapseAllProjects action to uiStateStore.ts that sets all specified project IDs to collapsed in a single operation, no-op if nothing changes.
  • Adds a tooltip-wrapped button in Sidebar.tsx that triggers the new action; the button is hidden when no projects exist and disabled when all projects are already collapsed.

Macroscope summarized 82362d4.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4e94d87f-8dec-4c0d-b516-4d2bbc817b3f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 23, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 23, 2026

Approvability

Verdict: Approved

This PR adds a straightforward 'Collapse all' button for the projects sidebar with corresponding state management and unit tests. The changes are purely additive UI functionality with no backend or security implications.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
Copy link
Copy Markdown
Member

what do you tihnk of making this 3 states:

  • minimize all - collapses every project down to the "show less" state
  • collapse all - collapses every project completely
  • disabled - when everything's collapsed

@kyziq
Copy link
Copy Markdown
Author

kyziq commented May 5, 2026

thanks for your reply julius!

looked at vscode, jetbrains, github. all have collapse-all only, no minimize. so my first thought was to keep it simple. but you have a point, minimize-all is actually useful here since projects can hold many threads with overflow, lets you reset it without losing your place

If we want both, I think a dropdown trigger (single header slot) feels cleaner than two adjacent buttons or one single button that does all. what do you think?

@kyziq
Copy link
Copy Markdown
Author

kyziq commented May 5, 2026

prototyped the dropdown:

t3code-05052026.mp4
  • collapse-all enabled when any project is expanded
  • minimize-all enabled when any thread list is expanded
  • trigger enabled when either applies

happy either way. can revert to collapse-all only if you prefer minimal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Collapse all projects button in sidebar

2 participants