Hand: drag-and-drop reordering and Sort button #11

Merged
cmoriarty merged 1 commit from hand-sort-dnd into main 2026-11-07 01:36:12 -05:00
Owner

What

Reorder the hand by dragging cards (mouse or touch), or press the new Sort button to group by suit — trump first, then the other suits in standard order — each low-to-high by value.

Details

  • Drag and drop via @dnd-kit (core/sortable/utilities). PointerSensor with an 8px activation distance, so a tap still selects/plays and a drag reorders. Keyboard dragging is disabled so arrow keys keep navigating the hand.
  • Sort button (top-right of the hand): trump suit leftmost, then the other suits, each by value. Pure sortHand helper with unit tests.
  • Order is local presentation state (card ids) reconciled with the server hand: a played card drops out, a fresh deal resets to the dealt order.
  • Illegal cards stay enabled (so they can be dragged) but remain dimmed.
  • touch-action: none on hand cards so touch drags don't scroll the page.

Verified

  • 155/155 tests, typecheck clean.
  • Browser (320px mobile viewport): Sort produces trump-first order; synthetic pointer drag reorders the hand.
  • iOS simulator (iPhone 17 Pro): Sort tap works on touch; touch drag moved the first card to the end; illegal cards dimmed but draggable.
## What Reorder the hand by dragging cards (mouse or touch), or press the new **Sort** button to group by suit — trump first, then the other suits in standard order — each low-to-high by value. ## Details - **Drag and drop** via @dnd-kit (core/sortable/utilities). PointerSensor with an 8px activation distance, so a tap still selects/plays and a drag reorders. Keyboard dragging is disabled so arrow keys keep navigating the hand. - **Sort button** (top-right of the hand): trump suit leftmost, then the other suits, each by value. Pure `sortHand` helper with unit tests. - Order is **local presentation state** (card ids) reconciled with the server hand: a played card drops out, a fresh deal resets to the dealt order. - **Illegal cards stay enabled** (so they can be dragged) but remain dimmed. - `touch-action: none` on hand cards so touch drags don't scroll the page. ## Verified - 155/155 tests, typecheck clean. - Browser (320px mobile viewport): Sort produces trump-first order; synthetic pointer drag reorders the hand. - iOS simulator (iPhone 17 Pro): Sort tap works on touch; touch drag moved the first card to the end; illegal cards dimmed but draggable.
Reorder the hand by dragging cards (mouse or touch, @dnd-kit) or press
the new Sort button to group by suit — trump first, then the other
suits in standard order — each low-to-high by value.

- Local display order (card ids) reconciled with the server hand; a
  fresh deal resets to the dealt order, a played card drops out.
- PointerSensor with an 8px activation distance so a tap still selects
  and plays; keyboard dragging is off so arrow keys keep navigating.
- Illegal cards stay enabled (draggable) but dimmed.
- sortHand helper + unit tests; Hand rewritten on @dnd-kit sortable;
  Sort control, dragging state and touch-action in styles.css.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/scratch-vllm-fp8!11
No description provided.