mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
feat(console): reorder a group's routes by drag or keyboard
The per-card up/down arrows saved after every single step, so moving a route five places took five writes. A Reorder mode on the group page now swaps each card's switch for a drag handle: pointer drags (mouse and touch) slide the neighbours out of the way and auto-scroll near the viewport edges, Arrow Up/Down on a focused handle moves a card by one and is announced to screen readers, and nothing is written until Save order. Cancel or Escape (unless a dialog or list owns it) drops the draft. The cards move into a new RouteList component that owns the drag state.
This commit is contained in:
1 parent
2eac368602
commit
08dfac52cd
10 files changed
+504
-71
No files matched your search
@@ -290,6 +290,8 @@
|
||||
|
||||
.route-card {
|
||||
@apply block animate-rise rounded-xl border border-border bg-surface px-4 py-3 shadow-xs transition-all duration-150;
|
||||
/* Only the entry delay keeps the hidden state: inline transforms (drag) must win afterwards. */
|
||||
animation-fill-mode: backwards;
|
||||
}
|
||||
|
||||
.route-card:hover {
|
||||
@@ -414,6 +416,52 @@
|
||||
@apply min-w-0 truncate font-mono text-[11.5px] text-text;
|
||||
}
|
||||
|
||||
/* ---- Route reordering ---- */
|
||||
.route-handle {
|
||||
@apply grid h-9 w-9 cursor-grab place-items-center rounded-lg text-muted transition-colors hover:bg-surface-2 hover:text-text;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.route-handle:disabled {
|
||||
@apply cursor-not-allowed opacity-40 hover:bg-transparent;
|
||||
}
|
||||
|
||||
.route-handle:focus-visible {
|
||||
@apply outline-2 outline-offset-2 outline-accent;
|
||||
}
|
||||
|
||||
.route-list.is-reordering .route-card {
|
||||
@apply select-none;
|
||||
}
|
||||
|
||||
.route-list.is-dragging .route-card {
|
||||
transition: transform 180ms ease;
|
||||
}
|
||||
|
||||
.route-list.is-dragging .route-handle {
|
||||
@apply cursor-grabbing;
|
||||
}
|
||||
|
||||
.route-list .route-card.is-dragged {
|
||||
@apply relative z-10 border-accent shadow-lg;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.route-list .route-card.is-dragged.is-settling {
|
||||
transition: transform 150ms ease;
|
||||
}
|
||||
|
||||
.route-list.is-committing .route-card {
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.route-list.is-dragging .route-card,
|
||||
.route-list .route-card.is-dragged.is-settling {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- Toggle switch ---- */
|
||||
.switch {
|
||||
@apply relative h-[22px] w-[38px] flex-shrink-0;
|
||||
|
||||
Reference in new issue
Block a user