Skip to content

feat: tag drag-to-reorder (#41)#71

Merged
meninoebom merged 4 commits into
mainfrom
feature/GH-41-tag-drag-reorder
Apr 28, 2026
Merged

feat: tag drag-to-reorder (#41)#71
meninoebom merged 4 commits into
mainfrom
feature/GH-41-tag-drag-reorder

Conversation

@meninoebom
Copy link
Copy Markdown
Owner

Closes #41

Summary

  • Adds position column to Tag model with Alembic migration
  • PATCH /api/tags/reorder (auth-required) assigns server-side positions from an ordered list of tag IDs
  • GET /api/tags now returns tags in position order (nulls last, then alphabetical as tiebreaker)
  • New tags auto-assign the next available position on creation
  • Frontend: drag-and-drop reorder in both vertical sidebar and horizontal mobile pill strip via dnd-kit
  • Drag handles only visible when authenticated; anonymous readers see the custom order without handles
  • New "custom" sort mode cycles: usage → alpha → custom (server position order)
  • Optimistic local reorder on drop + async PATCH /api/tags/reorder + query invalidation

Test plan

  • Create several tags and verify they appear in creation order by default
  • Log in → drag a tag in the sidebar → refresh → confirm new order persists
  • Log in → drag a tag in the mobile pill strip → confirm new order persists
  • Log out → confirm drag handles are hidden, order still reflects server position
  • Cycle sort toggle: custom → usage → alpha → custom
  • Run backend test suite: uv run pytest (200/200)
  • Run npm run build (type-clean)

🤖 Generated with Claude Code

meninoebom and others added 2 commits April 27, 2026 18:29
- Add nullable `position` int column to Tag model
- New tags auto-assigned next position on creation
- `GET /api/tags` now orders by position (nulls last), then name
- `PATCH /api/tags/reorder` (auth-required) accepts ordered tag_ids
- Alembic migration 598878310987

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Install @dnd-kit/core, @dnd-kit/sortable, @dnd-kit/utilities
- Sidebar (vertical) and mobile pill strip (horizontal) both support
  drag reorder via dnd-kit SortableContext
- Drag handles show on hover in sidebar; visible in pill strip
- Drag handles only appear when authenticated (reorder is auth-required)
- On drop: optimistic local reorder + async PATCH /api/tags/reorder
- New "custom" sort mode (server position order); cycles usage → alpha → custom
- Non-authenticated readers see custom order without drag handles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@railway-app
Copy link
Copy Markdown

railway-app Bot commented Apr 28, 2026

🚅 Deployed to the breadcrumbs-pr-71 environment in Breadcrumbs

Service Status Web Updated (UTC)
Breadcrumbs Web App Server ✅ Success (View Logs) Web Apr 28, 2026 at 1:40 am

@railway-app railway-app Bot temporarily deployed to Breadcrumbs / breadcrumbs-pr-71 April 28, 2026 01:32 Destroyed
- Fix N+1: compute next tag position once before loop, not per tag
- Migration: backfill positions for existing tags (alphabetical order)
  so no tag starts as NULL after deploy
- DnD: clear localOrder after successful server sync; rollback on error
- SortToggle: fix label/title mapping for all three sort modes
- Move nulls_last import to module level

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@railway-app railway-app Bot temporarily deployed to Breadcrumbs / breadcrumbs-pr-71 April 28, 2026 01:36 Destroyed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@railway-app railway-app Bot temporarily deployed to Breadcrumbs / breadcrumbs-pr-71 April 28, 2026 01:39 Destroyed
@meninoebom meninoebom merged commit 40504d8 into main Apr 28, 2026
3 checks passed
@meninoebom meninoebom deleted the feature/GH-41-tag-drag-reorder branch April 28, 2026 01:56
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.

Tag reordering (drag-and-drop)

1 participant