feat(console): add in-app destructive-action confirmation

Deleting a route or a group used `window.confirm`, which blocks the page
and ignores the console theme. A promise-based `useConfirm()` now drives
one <ConfirmDialog /> built on the reka-ui AlertDialog that
@elysola/ui ships; reka-ui is pre-bundled so dev keeps a single copy and
the dialog stacks with the Rc dialogs.

A request never outlives its asker: one made after the asking component
unmounted resolves false, and one still open when it unmounts is
cancelled.
This commit is contained in:
翅膀 committed 2026-10-17 00:12:36 +08:00
1 parent d57e5c29c4
commit 24f5d0477c
8 files changed
+239 -7

No files matched your search

+4
View File
@@ -394,6 +394,8 @@ const en: Dict = {
"confirm.deleteRoute": 'Delete route "{name}"?',
"confirm.deleteGroup": 'Delete group "{name}"?',
"confirm.deleteGroupWarn": " {n} route(s) reference it and will lose their group.",
"confirm.cancel": "Cancel",
"confirm.delete": "Delete",
};
const zh: Dict = {
@@ -782,6 +784,8 @@ const zh: Dict = {
"confirm.deleteRoute": "确定删除路由“{name}”吗?",
"confirm.deleteGroup": "确定删除分组“{name}”吗?",
"confirm.deleteGroupWarn": " 有 {n} 条路由引用它,将失去所属分组。",
"confirm.cancel": "取消",
"confirm.delete": "删除",
};
const messages: Record<Locale, Dict> = { en, zh };