Skip to content

Restore archived widgets by dragging them into any board slot#79

Merged
danielchalmers merged 4 commits into
mainfrom
restore-by-dragging-onto-board
Jul 6, 2026
Merged

Restore archived widgets by dragging them into any board slot#79
danielchalmers merged 4 commits into
mainfrom
restore-by-dragging-onto-board

Conversation

@danielchalmers

@danielchalmers danielchalmers commented Jul 6, 2026

Copy link
Copy Markdown
Owner

What

Dragging a card out of the archive now works exactly like a normal board drag: carry it up onto the board and the board parts to make room — the card joins the grid as a dimmed placeholder in the slot it will take, tracking the cursor just like a native reorder. Drop to restore it there. The previous fixed "restore zone" overlay is gone. Archiving is unchanged — drag a board card down to the simple drop zone at the bottom.

How

  • New BoardDnd component — a single DndContext shared by the active board and the archived list, so a card can travel between the two sortable grids mid-drag. It owns the sensors, the archive drop zone, the drag overlay, and routes drops: same list → reorder; archived → board → restore into the previewed slot; board card → archived card → archive.
  • Live gap preview (dnd-kit multi-container pattern) — on onDragOver, BoardDnd builds a preview widget list where the restore already happened, and the page renders through a render prop that follows it. Once the card is a member of the board''s sortable context, dnd-kit''s own sort transforms take over, so within-board movement is pixel-identical to a normal reorder. Dragging back over the archive or cancelling discards the preview; dropping commits it through the same restoreWidget storage path.
  • BoardList slimmed down — no longer owns a drag context; it reads the shared one via useDndContext. A new restoreTarget flag marks the active board: it outlines while an archived card approaches, and an empty board doubles as a drop target ("Drop it here to restore") so restore-by-drag still works when everything is archived.
  • restoreWidget(widgets, id, beforeId?) — takes an optional board card to insert in front of; without one it falls back to the end of the board as before.
  • The archive drop zone returns to its original compact size (it was only enlarged to mirror the removed restore zone).

Tests

  • New unit tests for positional restore and its fallbacks (unknown/archived drop target).
  • Rewrote the restore e2e test: asserts the board outline appears on lift, the dragged card joins the board grid as a dimmed placeholder mid-drag, the hovered card rings as the slot, and the card lands in slot one ahead of "Local time".
  • Full suite green: typecheck, 116 unit tests, 43 e2e tests.

Archiving and restoring both used the same drop strip pinned to the bottom
of the viewport, so restoring meant dragging a card down to the very spot
used to archive it — the reverse action shared the same target and read as
unintuitive.

Make restore the spatial mirror of archive: the restore drop zone now pins
to the top over the active board, so an archived card is dragged back up
onto the board to bring it back, and can be dropped anywhere across the
zone. Both zones share one medium size and differ only in position.

The DropZone component takes a `placement` and the restore variant only
overrides its vertical anchor; the two DnD contexts and the archive/restore
reducers are unchanged. Update the Playwright restore test to drag up and
assert the target sits above the card being restored.
One shared drag context (BoardDnd) now spans the active board and the
archived list, so an archived card can be dragged onto any board card
and take its slot, with the board outlined and the hovered card ringed
as live feedback. An empty board doubles as the drop target. Archiving
keeps the simple bottom drop zone; the mirrored restore zone is gone.
While an archived card hovers over the board, BoardDnd swaps in a
preview list where the restore already happened: the card joins the
board grid as a dimmed placeholder and the other cards part to make
room, exactly like a native reorder. Dropping commits the previewed
slot; dragging back to the archive or cancelling discards it. The
lists now render through a render prop so they follow the preview.
@danielchalmers danielchalmers merged commit e2aa2e0 into main Jul 6, 2026
5 checks passed
@danielchalmers danielchalmers deleted the restore-by-dragging-onto-board branch July 6, 2026 02:59
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.

1 participant