Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(sidebar): pin chats within projects #4047

Closed12ya(GitHub profile, opens in a new tab)wants to merge 15 commits intomain fromrefs/pull/4047/headopened View on GitHub

What Changed

  • Persist pinned chat state per logical project.
  • Keep pinned chats above the normal thread sort order for each project.
  • Add hover pin and unpin controls without consuming title space.
  • Support pinning and unpinning by dragging a chat across the pinned divider.
  • Show a compact divider with distinct pin/unpin feedback.
  • Animate chats moving between pinned and regular sections.

Why

Important chats should stay easy to reach without being pinned globally across unrelated projects. Project-scoped pinning keeps each sidebar group predictable while preserving the existing thread sort order for unpinned chats.

The hover control provides a quick direct action, while divider-crossing drag behavior makes sidebar organization feel natural.

Validation

  • vp check
  • vp run typecheck
  • vp test apps/web/src/components/Sidebar.logic.test.ts apps/web/src/uiStateStore.test.ts — 81 tests passed

UI Changes

Interaction demo:

https://github.com/user-attachments/assets/e7f8fd01-00dc-4ff6-84ee-15bf7d979f8f

Replaces #3913, whose head accidentally tracked the fork's long-lived main branch.

Note

Add pin/unpin support for chat threads within sidebar projects

  • Adds a pin/unpin button to each thread row in the sidebar, with drag-and-drop reordering across a visual pinned/unpinned divider in SidebarProjectThreadList.
  • Pinned thread keys are stored per-project in uiStateStore and persisted to localStorage via pinnedThreadKeysByProject.
  • Pinned threads are always shown in the sidebar even when a project is folded beyond the preview limit, alongside the active thread.
  • New logic helpers (prioritizeThreadsByPinnedKeys, resolveThreadPinCrossingAction, shouldShowPinnedThreadDivider, shouldBlockThreadDragActivation) handle ordering, drag state, and divider rendering.
  • Behavioral Change: getVisibleThreadsForProject now accepts optional getThreadId/isThreadAlwaysVisible params; hasHiddenThreads now reflects whether threads are actually hidden rather than whether the list exceeds the limit.
Macroscope summarized 16a5331.

Note

Low Risk Client-only UI state in localStorage and sidebar interaction logic; no auth or server data changes.

Overview Adds project-scoped thread pinning in the sidebar: pinned chats stay at the top of each project (after the normal sort), persist in pinnedThreadKeysByProject via uiStateStore, and remain visible when the thread list is folded.

Pin/unpin UX: hover pin controls on each row (with desktop row-action visibility tweaks via shouldHideThreadMeta), plus drag across a pinned divider (DndContext / useDraggable) with divider coloring from resolveThreadPinCrossingAction. Drag does not start from buttons/inputs (shouldBlockThreadDragActivation); clicks are suppressed after a drag.

Logic: prioritizeThreadsByPinnedKeys, divider visibility helpers, and an extended getVisibleThreadsForProject (scoped keys, isThreadAlwaysVisible for pins) drive list rendering and jump/preview behavior.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 16a533196eb2e35250becad02af01884364e7849. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: 54cdaed2-8d5b-4589-86d0-a057eabb9f7f

      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

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High

      https://github.com/pingdotgg/t3code/blob/e42b0312a52e3fd989e6903b4392d75ec20b148e/apps/web/src/components/Sidebar.tsx#L529

      Releasing a thread drag fires the row's onClick handler (handleRowClick), navigating to that thread — even when the user was only reordering it. The project-level drag path guards against this with suppressProjectClickAfterDragRef, but the new useDraggable-based thread drag has no equivalent suppression, so dropping a thread into a new position also changes the active route and closes the mobile sidebar. Consider tracking drag completion and short-circuiting handleRowClick when the pointer-up followed a drag, mirroring the project drag suppression pattern.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/Sidebar.tsx around line 529:
      
      Releasing a thread drag fires the row's `onClick` handler (`handleRowClick`), navigating to that thread — even when the user was only reordering it. The project-level drag path guards against this with `suppressProjectClickAfterDragRef`, but the new `useDraggable`-based thread drag has no equivalent suppression, so dropping a thread into a new position also changes the active route and closes the mobile sidebar. Consider tracking drag completion and short-circuiting `handleRowClick` when the pointer-up followed a drag, mirroring the project drag suppression pattern.
    4. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e42b0312a52e3fd989e6903b4392d75ec20b148e. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR introduces a new user-facing feature (pinning chats within projects) with drag-and-drop interactions, new UI components, and new persisted state. New features with user-facing behavior changes warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    6. Fixed in f4e8db9fe. Thread drag start now arms a one-shot click suppression; the row consumes the post-drag click, while the next pointer-down clears any stale guard.

    7. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    8. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      Closing this PR after an automated pass over open pull requests. Thread pinning already shipped in #5312 and synchronized ordering shipped in #5581.

Sign in to join this conversation.