Skip to content

feat(sidebar): drag-to-reorder workspace projects (#87)#119

Merged
DeadWaveWave merged 16 commits intoDeadWaveWave:mainfrom
yinuotxie:feat/sidebar-drag-reorder
Mar 30, 2026
Merged

feat(sidebar): drag-to-reorder workspace projects (#87)#119
DeadWaveWave merged 16 commits intoDeadWaveWave:mainfrom
yinuotxie:feat/sidebar-drag-reorder

Conversation

@yinuotxie
Copy link
Copy Markdown
Contributor

@yinuotxie yinuotxie commented Mar 30, 2026

Summary

Closes #87

Users with many projects can now drag sidebar items to reorder them. The new order persists across app restarts via a sort_order column in the SQLite workspaces table.

Changes

  • Persistence: Add sort_order column to workspaces table with migration + backfill for existing databases
  • Read path: Load workspaces ordered by sort_order ascending
  • Write path: Save array index as sort_order on every persist
  • Store: Add reorderWorkspaces(activeId, overId) action using arrayMove from @dnd-kit/sortable
  • Sidebar UI: Wrap workspace list with DndContext / SortableContext / useSortable; DragOverlay shows semi-transparent preview; PointerSensor with distance: 8 distinguishes click from drag
  • CSS: Drag overlay and dimmed-origin styles

Demo

Screen.Recording.2026-03-30.at.1.56.43.PM.mov

Test plan

  • pnpm pre-commit passes (188 E2E + 480 unit/contract tests)
  • E2E: drag reorder persists new order (workspace-canvas.sidebar-drag-reorder.spec.ts)
  • E2E: click still selects workspace after dnd-kit setup
  • E2E: right-click context menu works on sortable items
  • Unit: reorderWorkspaces store action (swap, no-op, invalid IDs)
  • Unit: Sidebar component drag overlay + dim + reorder callback
  • Contract: sort_order written as array index, read back in order
  • Contract: migration backfill preserves insertion order

yinuotxie and others added 15 commits March 30, 2026 11:47
…est file

Add backfillWorkspaceSortOrder call to the legacy v1 migration branch
so migrated workspaces get proper sort_order values. Move sort_order
migration tests to dedicated spec file to keep persistenceStore.spec.ts
under the 500-line limit.
- Add 3 E2E tests: drag reorder + persistence, click selection, context menu
- Fix Sidebar.spec.tsx TS errors: replace jest-dom matchers with standard assertions

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

DeadWaveWave commented Mar 30, 2026

感谢你的贡献!但是 CI 未通过,需要本地通过 pnpm pre-commit 后再次提交。此外,希望你测试一下在有 Agent 窗口的情况下对应 project 下的 Agent list 会不会正确跟随 project 一起移动

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

Test.mov

测试:在有 Agent 窗口的情况下对应 project 下的 Agent list跟随Project移动

@DeadWaveWave DeadWaveWave merged commit 5087c4e into DeadWaveWave:main Mar 30, 2026
3 checks passed
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.

[FEAT] 左侧的项目能够手动拖动,排列顺序

2 participants