Skip to content

feat: drag to reorder sites - #43

Merged
jasoncrawford merged 8 commits into
mainfrom
feature/drag-reorder-sites
Feb 22, 2026
Merged

jasoncrawford merged 8 commits into
mainfrom
feature/drag-reorder-sites

Conversation

@jasoncrawford

Copy link
Copy Markdown
Collaborator

Summary

  • Adds position column to sites table with migration to backfill existing rows alphabetically
  • Extracts site list into a SiteList client component using @dnd-kit for drag-and-drop
  • Admin users see a grip handle on hover and can drag to reorder; order persists via reorderSites server action
  • New sites are appended at the end (position = max + 1)
  • Non-admin visitors see the same static list as before

Closes #41

Test plan

  • Log in as admin, verify drag handles appear on hover
  • Drag a site to a new position, refresh page — order should persist
  • Log out, verify no drag handles and list renders normally
  • Add a new site, verify it appears at the end of the list
  • Verify migration runs cleanly on Supabase preview branch

🤖 Generated with Claude Code

Add position column to sites table and implement drag-and-drop reordering
using @dnd-kit. Logged-in admins see a grip handle on hover and can drag
list items to set custom order. Order persists via a new reorderSites
server action. New sites are appended at the end.

Closes #41

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Feb 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
site-status Ready Ready Preview, Comment Feb 22, 2026 7:14pm

Request Review

@supabase

supabase Bot commented Feb 22, 2026 •

Copy link
Copy Markdown

Updates to Preview Branch (feature/drag-reorder-sites) ↗︎

Deployments Status Updated
Database ✅ Sun, 22 Feb 2026 19:14:47 UTC
Services ✅ Sun, 22 Feb 2026 19:14:47 UTC
APIs ✅ Sun, 22 Feb 2026 19:14:47 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations ✅ Sun, 22 Feb 2026 19:14:48 UTC
Migrations ✅ Sun, 22 Feb 2026 19:14:49 UTC
Seeding ✅ Sun, 22 Feb 2026 19:14:50 UTC
Edge Functions ✅ Sun, 22 Feb 2026 19:14:50 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

…erSites tests

The addSite mock now handles the select→order→limit→single chain for
fetching max position, and the insert assertion includes the position
field. Also adds tests for the new reorderSites action.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The packages were installed locally but not committed when the branch
was recreated, causing build failures in CI and Vercel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The client component's useState kept stale data after server actions
called revalidatePath. Now detects when server-provided props change
and syncs local state, so add/edit/delete are reflected immediately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Position the grip icon to the left of the card border instead of
inside the card content area, eliminating the empty gap on the left
when the handle is hidden.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds 4 sites with check histories demonstrating each status:
- Healthy Site: all passing → Up (green)
- Flaky Site: one 503 among passing checks → Transient Failures (amber)
- Broken Site: one HTTP 500 → Failures (red)
- Down Site: 6 consecutive 503s with open incident

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jasoncrawford

Copy link
Copy Markdown
Collaborator Author

Two issues:

  • The cards are now not left-aligned with the Sites header, and with the Add-site button. All those things should be left-aligned, and the drag handles should be in the margin to the left.
  • When I drag a card, it can be dragged all over the screen. It should be constrained to drag vertically only.

The outer SortableSiteCard wrapper and inner SiteCard both had the
Tailwind 'group' class, causing Playwright's .group locator to match
two elements per card. Now only the outermost container gets 'group'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Position drag handle absolutely in the left margin so cards stay
  left-aligned with the Sites heading and Add site button
- Add restrictToVerticalAxis modifier so items can only be dragged
  up and down, not freely across the screen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jasoncrawford
jasoncrawford merged commit f8b7069 into main Feb 22, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 1ec87bed Deployed Feb 22, 2026 by vercel[bot]
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.

Drag to reorder sites on main view

1 participant