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:
翅膀 committed 2026-10-17 02:52:14 +08:00
1 parent 2eac368602
commit 08dfac52cd
10 files changed
+504 -71

No files matched your search

+16
View File
@@ -142,6 +142,13 @@ const en: Dict = {
"group.routesIn": "Routes in {name}",
"routes.emptyGroup": "No routes in this group yet.",
"routes.createFirst": "Create your first route",
"routes.reorder": "Reorder",
"routes.reorderHint": "Drag routes by their handle to change the evaluation order, then save.",
"routes.reorderKeyboardHint": "Press Arrow Up or Arrow Down to move this route.",
"routes.reorderSave": "Save order",
"routes.reorderCancel": "Cancel",
"routes.dragHandle": "Reorder {name}",
"routes.moved": "{name} moved to position {n}",
"routes.delete": "Delete route",
"route.untitled": "(untitled)",
"route.noFilters": "no filters",
@@ -392,6 +399,7 @@ const en: Dict = {
"toast.groupIdExists": "Group ID already exists",
"toast.saveFailed": "Save failed: {msg}",
"toast.deleteFailed": "Delete failed: {msg}",
"toast.orderSaved": "Route order saved",
"confirm.deleteRoute": 'Delete route "{name}"?',
"confirm.deleteGroup": 'Delete group "{name}"?',
"confirm.deleteGroupWarn": " {n} route(s) reference it and will lose their group.",
@@ -544,6 +552,13 @@ const zh: Dict = {
"group.routesIn": "{name} 的路由",
"routes.emptyGroup": "该分组还没有路由。",
"routes.createFirst": "创建第一个路由",
"routes.reorder": "调整顺序",
"routes.reorderHint": "拖动手柄调整路由的评估顺序,完成后保存。",
"routes.reorderKeyboardHint": "按上下方向键移动该路由。",
"routes.reorderSave": "保存顺序",
"routes.reorderCancel": "取消",
"routes.dragHandle": "调整“{name}”的顺序",
"routes.moved": "“{name}”已移到第 {n} 位",
"routes.delete": "删除路由",
"route.untitled": "(未命名)",
"route.noFilters": "无过滤器",
@@ -792,6 +807,7 @@ const zh: Dict = {
"toast.groupIdExists": "分组 ID 已存在",
"toast.saveFailed": "保存失败:{msg}",
"toast.deleteFailed": "删除失败:{msg}",
"toast.orderSaved": "路由顺序已保存",
"confirm.deleteRoute": "确定删除路由“{name}”吗?",
"confirm.deleteGroup": "确定删除分组“{name}”吗?",
"confirm.deleteGroupWarn": " 有 {n} 条路由引用它,将失去所属分组。",