fix(desktop): enable workspace drag reordering in collapsed v2 sidebar

Merged
AV
4mo ago
+153-20

Summary

In the v2 sidebar, workspaces could only be drag-reordered when the sidebar was expanded — the collapsed rail rendered workspace icons as plain, non-draggable items (v1 supports dragging in both states).

  • Wire useSidebarDnd into DashboardSidebarCollapsedProjectContent so collapsed workspace icons are sortable via the same DndContext/SortableContext setup as the expanded list
  • Add a SortableCollapsedWorkspaceItem wrapper (mirrors SortableWorkspaceItem) applying the sortable transform/listeners around the collapsed icon
  • Reorders persist through the same commit path as expanded mode, including implicit cross-section moves; the pinned local workspace stays non-draggable, matching expanded behavior

Test Plan

  • Collapse the v2 sidebar, drag a workspace icon to a new position — order updates and persists
  • Expand the sidebar — new order is reflected (including section membership if dragged past a section boundary)
  • Click, right-click context menu, and hover card on collapsed icons still work (drag only activates after 8px movement)
  • bun run typecheck and bun run lint pass

https://claude.ai/code/session_01YRQUW3p84JVMXjjHp2sBs2


Summary by cubic

Enables drag-and-drop reordering of workspaces in the collapsed v2 sidebar, matching the expanded sidebar and v1 behavior. Order changes persist (including cross-section moves) and remain stable across collapse/expand.

  • Bug Fixes
    • Wired useSidebarDnd into collapsed project content via DndContext and SortableContext from @dnd-kit/core/@dnd-kit/sortable.
    • Added SortableCollapsedWorkspaceItem so only workspace icons in the rail are draggable; pinned local main workspace remains non-draggable.
    • Normalizes drop results to keep pinned local main workspaces first, preventing silent reorders on remount.

Summary by CodeRabbit

  • New Features
    • Added drag-and-drop support to reorder workspaces in the collapsed project sidebar.
    • Workspace tiles now show clear drag-and-drop visual feedback during sorting.
    • Maintains existing workspace hover behavior and shortcut labels in the collapsed sidebar.
  • Improvements
    • Improved drag behavior to keep “pinned” local workspaces ordered at the top after rearranging.