From ea39200111c51d3fc74868e53cac63b79242d3fa Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Fri, 31 Jul 2026 17:38:33 +0800 Subject: [PATCH] feat(webui): unify dialog feedback Move confirmations, editors, and help surfaces onto one consistent interaction model. Preserve accessible focus handling while making destructive and in-progress actions clearer. --- packages/webui/package.json | 1 - .../src/components/change-password-dialog.tsx | 48 +- .../components/config/node-edit-dialog.tsx | 233 +++++---- .../webui/src/components/confirm-dialog.tsx | 71 ++- .../src/components/debug/action-tester.tsx | 53 +- .../webui/src/components/interior/modal.tsx | 464 ++++++++++++++++++ .../webui/src/components/pages/login-page.tsx | 24 +- .../src/components/pages/overview-page.tsx | 19 +- .../src/components/process-probe-dialog.tsx | 151 +++--- .../settings/notification-channel-dialog.tsx | 140 +++--- .../webui/src/components/ui/alert-dialog.tsx | 97 ---- packages/webui/src/components/ui/dialog.tsx | 109 ---- pnpm-lock.yaml | 3 - 13 files changed, 805 insertions(+), 608 deletions(-) create mode 100644 packages/webui/src/components/interior/modal.tsx delete mode 100644 packages/webui/src/components/ui/alert-dialog.tsx delete mode 100644 packages/webui/src/components/ui/dialog.tsx diff --git a/packages/webui/package.json b/packages/webui/package.json index 0074fca7..c74d0aff 100644 --- a/packages/webui/package.json +++ b/packages/webui/package.json @@ -13,7 +13,6 @@ "preview": "vite preview" }, "dependencies": { - "@radix-ui/react-alert-dialog": "^1.1.7", "@radix-ui/react-dialog": "^1.1.7", "@radix-ui/react-label": "^2.1.3", "@radix-ui/react-scroll-area": "^1.2.4", diff --git a/packages/webui/src/components/change-password-dialog.tsx b/packages/webui/src/components/change-password-dialog.tsx index 1ccb992c..2d12c38d 100644 --- a/packages/webui/src/components/change-password-dialog.tsx +++ b/packages/webui/src/components/change-password-dialog.tsx @@ -1,10 +1,4 @@ -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; +import { Modal } from '@/components/interior/modal'; import { ChangePasswordForm } from '@/components/pages/change-password-form'; import { useApi } from '@/lib/api'; @@ -17,32 +11,30 @@ interface ChangePasswordDialogProps { /** * In-app "修改访问密码" modal. The forced first-time flow uses the full-screen - * ChangePasswordPage; this is the voluntary change a logged-in admin triggers + * the onboarding wizard; this is the voluntary change a logged-in admin triggers * from 设置 → 账号安全. Both share ChangePasswordForm, so behaviour is identical. */ export function ChangePasswordDialog({ open, onOpenChange, onSuccess }: ChangePasswordDialogProps) { const api = useApi(); return ( - - - - 修改访问密码 - - 设置一个全新的强密码后,其它会话将被立即下线,需要重新登录。 - - - api.checkPasswordStrength(p)} - submit={(o, n) => api.changePassword(o, n)} - onSuccess={() => { - onSuccess(); - onOpenChange(false); - }} - onCancel={() => onOpenChange(false)} - idPrefix="dialog-cpw" - /> - - + onOpenChange(false)} + title="修改访问密码" + description="设置一个全新的强密码后,其它会话将被立即下线,需要重新登录。" + closeLabel="关闭修改密码弹窗" + > + api.checkPasswordStrength(p)} + submit={(o, n) => api.changePassword(o, n)} + onSuccess={() => { + onSuccess(); + onOpenChange(false); + }} + onCancel={() => onOpenChange(false)} + idPrefix="dialog-cpw" + /> + ); } diff --git a/packages/webui/src/components/config/node-edit-dialog.tsx b/packages/webui/src/components/config/node-edit-dialog.tsx index 06f3fe2f..29bc3f2f 100644 --- a/packages/webui/src/components/config/node-edit-dialog.tsx +++ b/packages/webui/src/components/config/node-edit-dialog.tsx @@ -20,15 +20,8 @@ import { Server, type LucideIcon, } from 'lucide-react'; +import { Modal } from '@/components/interior/modal'; import { Button } from '@/components/ui/button'; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; import { DropdownSelect, type DropdownOption } from '@/components/ui/dropdown-select'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; @@ -92,120 +85,27 @@ export function NodeEditDialog(props: NodeEditDialogProps const role = ((draft as WsServerNetwork | WsClientNetwork).role ?? 'Universal') as WsRole; return ( - - - -
-
- -
-
- {isEdit ? `编辑 ${tab.noun}` : `新建 ${tab.noun}`} - {tab.description} -
-
-
- -
-
- -
- -

- 关闭后保存即可保留配置但不启动该节点 -

-
- patch({ enabled: v ? undefined : false } as Partial>)} - ariaLabel="启用" - /> -
- -
-
- patch({ name: v } as Partial>)} - error={blankName ? '请填写名称' : duplicateName ? '名称与其它节点重复' : undefined} - /> - -
-
- -
-
- patch({ accessToken: v || undefined } as Partial>)} - /> -
-
- -
-
- {isHttpServer && ( - - patch({ enableWebSocket: v } as unknown as Partial>)} - ariaLabel="启用 WebSocket" - /> - - )} - - - patch({ messageFormat: v } as Partial>)} - /> - - - {isWs && ( - - patch({ role: v } as unknown as Partial>)} - /> - - )} - - - patch({ reportSelfMessage: v } as Partial>)} - ariaLabel="上报自身消息" - /> - -
-
-
-
- - - - -
-
+ + )} + > +
+ +
+ +

+ 关闭后保存即可保留配置但不启动该节点 +

+
+ patch({ enabled: v ? undefined : false } as Partial>)} + ariaLabel="启用" + /> +
+ +
+
+ patch({ name: v } as Partial>)} + error={blankName ? '请填写名称' : duplicateName ? '名称与其它节点重复' : undefined} + /> + +
+
+ +
+
+ patch({ accessToken: v || undefined } as Partial>)} + /> +
+
+ +
+
+ {isHttpServer && ( + + patch({ enableWebSocket: v } as unknown as Partial>)} + ariaLabel="启用 WebSocket" + /> + + )} + + + patch({ messageFormat: v } as Partial>)} + /> + + + {isWs && ( + + patch({ role: v } as unknown as Partial>)} + /> + + )} + + + patch({ reportSelfMessage: v } as Partial>)} + ariaLabel="上报自身消息" + /> + +
+
+
+ ); } diff --git a/packages/webui/src/components/confirm-dialog.tsx b/packages/webui/src/components/confirm-dialog.tsx index 23b559ce..973f90a0 100644 --- a/packages/webui/src/components/confirm-dialog.tsx +++ b/packages/webui/src/components/confirm-dialog.tsx @@ -1,21 +1,11 @@ -import { useState, type ReactNode } from 'react'; -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from '@/components/ui/alert-dialog'; -import { buttonVariants } from '@/components/ui/button'; +import { useRef, useState, type ReactNode } from 'react'; +import { Modal } from '@/components/interior/modal'; +import { Button } from '@/components/ui/button'; import { actionErrorMessage, useActionFeedback, type ActionFeedbackOptions, } from '@/contexts/ActionFeedbackContext'; -import { cn } from '@/lib/utils'; interface ConfirmDialogProps { open: boolean; @@ -47,6 +37,7 @@ export function ConfirmDialog({ const [busy, setBusy] = useState(false); const [error, setError] = useState(null); const { runAction } = useActionFeedback(); + const cancelRef = useRef(null); const handleConfirm = async () => { setBusy(true); @@ -74,36 +65,40 @@ export function ConfirmDialog({ }; return ( - - - - {title} - {description && ( - -
{description}
-
- )} -
+ handleOpenChange(false)} + title={title} + description={description} + showClose={false} + closeOnBackdrop={!busy} + closeOnEscape={!busy} + initialFocusRef={cancelRef} + maxWidth={512} + footer={( + <> + + + + )} + > +
{error && (
{error}
)} {content} - - {cancelText} - { - e.preventDefault(); - void handleConfirm(); - }} - className={cn(destructive && buttonVariants({ variant: 'destructive' }))} - disabled={busy || confirmDisabled} - > - {busy ? '处理中…' : confirmText} - - - - +
+
); } diff --git a/packages/webui/src/components/debug/action-tester.tsx b/packages/webui/src/components/debug/action-tester.tsx index f0f3867d..d8c9a218 100644 --- a/packages/webui/src/components/debug/action-tester.tsx +++ b/packages/webui/src/components/debug/action-tester.tsx @@ -11,6 +11,7 @@ import { AlertTriangle, FlaskConical, History, Loader2, Play, RotateCcw, ShieldC import { Textarea } from '@/components/ui/textarea'; import { Picker } from '@/components/ui/picker'; import { JsonTree } from '@/components/ui/json-tree'; +import { ConfirmDialog } from '@/components/confirm-dialog'; import { ParamField } from '@/components/debug/param-field'; import { Segmented } from '@/components/debug/segmented'; import { useApi } from '@/lib/api'; @@ -363,43 +364,21 @@ export function ActionTester({ accounts, docs, presetAction }: { accounts: QQInf )} - {confirmOpen && ( - setConfirmOpen(false)} - onConfirm={() => { setConfirmOpen(false); void runInvoke(); }} - /> - )} - - ); -} - -function ConfirmDestructive({ action, uin, onCancel, onConfirm }: { action: string; uin: string; onCancel: () => void; onConfirm: () => void }) { - useEffect(() => { - const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onCancel(); }; - window.addEventListener('keydown', onKey); - return () => window.removeEventListener('keydown', onKey); - }, [onCancel]); - return ( -
- e.stopPropagation()} - className="w-full max-w-sm rounded-2xl border border-border/60 bg-card p-5 shadow-xl" - > -
-
-

确认执行破坏性操作

-
-

- 即将以账号 {uin} 执行 {action},该操作会真实生效且通常不可撤销。确认继续? -

-
- - -
-
+ + 即将以账号 {uin} 执行{' '} + {actionName},该操作会 + 真实生效且通常不可撤销。确认继续? + + )} + confirmText="确认执行" + destructive + onConfirm={runInvoke} + />
); } diff --git a/packages/webui/src/components/interior/modal.tsx b/packages/webui/src/components/interior/modal.tsx new file mode 100644 index 00000000..c73a355d --- /dev/null +++ b/packages/webui/src/components/interior/modal.tsx @@ -0,0 +1,464 @@ +"use client"; + +import { + useCallback, + useEffect, + useId, + useLayoutEffect, + useMemo, + useRef, + useState, +} from "react"; +import { createPortal } from "react-dom"; +import { AnimatePresence, motion, useReducedMotion } from "motion/react"; + +const EASE = [0.23, 1, 0.32, 1] as const; + +const LEAVE = [0.4, 0, 1, 1] as const; + +const SURFACE = { type: "spring", stiffness: 420, damping: 36, mass: 0.9 } as const; + +const useIsomorphicLayoutEffect = + typeof window === "undefined" ? useEffect : useLayoutEffect; + +const FOCUSABLE = [ + "a[href]", + "area[href]", + "button:not([disabled])", + "input:not([disabled]):not([type='hidden'])", + "select:not([disabled])", + "textarea:not([disabled])", + "iframe", + "summary", + "[contenteditable='true']", + "[tabindex]:not([tabindex='-1'])", +].join(","); + +function focusableWithin(root: HTMLElement): HTMLElement[] { + return Array.from(root.querySelectorAll(FOCUSABLE)).filter( + (el) => + el.tabIndex !== -1 && + !el.hasAttribute("inert") && + el.getAttribute("aria-hidden") !== "true" && + el.getClientRects().length > 0, + ); +} + +let locks = 0; +let releaseLock: (() => void) | null = null; + +function lockDocumentScroll() { + locks += 1; + if (locks > 1) return; + + const body = document.body; + const gap = window.innerWidth - document.documentElement.clientWidth; + const overflow = body.style.overflow; + const paddingRight = body.style.paddingRight; + const base = Number.parseFloat(window.getComputedStyle(body).paddingRight); + + body.style.overflow = "hidden"; + if (gap > 0) { + body.style.paddingRight = `${(Number.isFinite(base) ? base : 0) + gap}px`; + } + + releaseLock = () => { + body.style.overflow = overflow; + body.style.paddingRight = paddingRight; + }; +} + +function unlockDocumentScroll() { + locks = Math.max(0, locks - 1); + if (locks > 0) return; + releaseLock?.(); + releaseLock = null; +} + +const stack: object[] = []; + +export type UseModalOptions = { + open: boolean; + onClose: () => void; + closeOnEscape?: boolean; + closeOnBackdrop?: boolean; + lockScroll?: boolean; + initialFocusRef?: React.RefObject; + container?: HTMLElement | null; +}; + +export type ModalOverlayProps = { + ref: React.RefObject; + onPointerDown: (event: React.PointerEvent) => void; + onClick: (event: React.MouseEvent) => void; +}; + +export type ModalPanelProps = { + ref: React.RefObject; + role: "dialog"; + "aria-modal": true; + "aria-labelledby": string; + tabIndex: -1; + onKeyDown: (event: React.KeyboardEvent) => void; +}; + +export type UseModalResult = { + target: HTMLElement | null; + titleId: string; + descriptionId: string; + overlayProps: ModalOverlayProps; + panelProps: ModalPanelProps; + close: () => void; +}; + +export function useModal({ + open, + onClose, + closeOnEscape = true, + closeOnBackdrop = true, + lockScroll = true, + initialFocusRef, + container, +}: UseModalOptions): UseModalResult { + const [target, setTarget] = useState(null); + + const overlayRef = useRef(null); + const panelRef = useRef(null); + const downedOutside = useRef(false); + + const baseId = useId(); + const titleId = `${baseId}-title`; + const descriptionId = `${baseId}-description`; + + const latest = useRef({ onClose, closeOnEscape, closeOnBackdrop, initialFocusRef }); + useEffect(() => { + latest.current = { onClose, closeOnEscape, closeOnBackdrop, initialFocusRef }; + }, [onClose, closeOnEscape, closeOnBackdrop, initialFocusRef]); + + const close = useCallback(() => latest.current.onClose(), []); + + useEffect(() => { + setTarget(container === undefined ? document.body : container); + }, [container]); + + useIsomorphicLayoutEffect(() => { + if (!open || !lockScroll) return; + lockDocumentScroll(); + return () => unlockDocumentScroll(); + }, [open, lockScroll]); + + useEffect(() => { + if (!open || !target) return; + const overlay = overlayRef.current; + const parent = overlay?.parentElement; + if (!overlay || !parent) return; + + const changed: Array<[Element, string | null]> = []; + for (const child of Array.from(parent.children)) { + if (child === overlay) continue; + changed.push([child, child.getAttribute("inert")]); + child.setAttribute("inert", ""); + } + + return () => { + for (const [child, previous] of changed) { + if (previous === null) child.removeAttribute("inert"); + else child.setAttribute("inert", previous); + } + }; + }, [open, target]); + + useEffect(() => { + if (!open) return; + const token = {}; + stack.push(token); + + const onKeyDown = (event: KeyboardEvent) => { + if (event.key !== "Escape") return; + if (stack[stack.length - 1] !== token) return; + if (!latest.current.closeOnEscape) return; + event.preventDefault(); + event.stopPropagation(); + latest.current.onClose(); + }; + + document.addEventListener("keydown", onKeyDown); + return () => { + document.removeEventListener("keydown", onKeyDown); + const index = stack.indexOf(token); + if (index > -1) stack.splice(index, 1); + }; + }, [open]); + + useEffect(() => { + if (!open || !target) return; + const onFocusIn = (event: FocusEvent) => { + const panel = panelRef.current; + const node = event.target as Node | null; + if (!panel || !node || panel.contains(node)) return; + panel.focus({ preventScroll: true }); + }; + document.addEventListener("focusin", onFocusIn); + return () => document.removeEventListener("focusin", onFocusIn); + }, [open, target]); + + useEffect(() => { + if (!open || !target) return; + const panel = panelRef.current; + if (!panel) return; + + const previous = + document.activeElement instanceof HTMLElement ? document.activeElement : null; + const preferred = latest.current.initialFocusRef?.current; + (preferred ?? focusableWithin(panel)[0] ?? panel).focus({ preventScroll: true }); + + return () => { + if (previous && previous.isConnected) previous.focus({ preventScroll: true }); + }; + }, [open, target]); + + const onKeyDown = useCallback((event: React.KeyboardEvent) => { + if (event.key !== "Tab") return; + const panel = panelRef.current; + if (!panel) return; + + const items = focusableWithin(panel); + if (items.length === 0) { + event.preventDefault(); + panel.focus({ preventScroll: true }); + return; + } + + const first = items[0]; + const last = items[items.length - 1]; + const active = document.activeElement; + + if (event.shiftKey && (active === first || active === panel)) { + event.preventDefault(); + last.focus({ preventScroll: true }); + return; + } + if (!event.shiftKey && active === last) { + event.preventDefault(); + first.focus({ preventScroll: true }); + } + }, []); + + const onPointerDown = useCallback((event: React.PointerEvent) => { + const panel = panelRef.current; + downedOutside.current = !panel?.contains(event.target as Node); + }, []); + + const onClick = useCallback((event: React.MouseEvent) => { + const panel = panelRef.current; + if (!latest.current.closeOnBackdrop) return; + if (panel?.contains(event.target as Node)) return; + if (!downedOutside.current) return; + downedOutside.current = false; + latest.current.onClose(); + }, []); + + return { + target, + titleId, + descriptionId, + overlayProps: { ref: overlayRef, onPointerDown, onClick }, + panelProps: { + ref: panelRef, + role: "dialog", + "aria-modal": true, + "aria-labelledby": titleId, + tabIndex: -1, + onKeyDown, + }, + close, + }; +} + +const CLOSE_ICON = ( + +); + +export type ModalProps = { + open: boolean; + onClose: () => void; + title: React.ReactNode; + description?: React.ReactNode; + children?: React.ReactNode; + footer?: React.ReactNode; + closeLabel?: string; + showClose?: boolean; + closeOnEscape?: boolean; + closeOnBackdrop?: boolean; + lockScroll?: boolean; + initialFocusRef?: React.RefObject; + container?: HTMLElement | null; + maxWidth?: number; + maxHeight?: string; + className?: string; +}; + +export function Modal({ + open, + onClose, + title, + description, + children, + footer, + closeLabel = "Close dialog", + showClose = true, + closeOnEscape = true, + closeOnBackdrop = true, + lockScroll = true, + initialFocusRef, + container, + maxWidth = 440, + maxHeight = "min(78vh, 620px)", + className = "", +}: ModalProps) { + const reduced = useReducedMotion(); + + const { target, titleId, descriptionId, overlayProps, panelProps } = useModal({ + open, + onClose, + closeOnEscape, + closeOnBackdrop, + lockScroll, + initialFocusRef, + container, + }); + + const variants = useMemo(() => { + if (reduced) { + return { + backdrop: { + closed: { opacity: 0 }, + open: { opacity: 1, transition: { duration: 0 } }, + gone: { opacity: 0, transition: { duration: 0 } }, + }, + panel: { + closed: { opacity: 0 }, + open: { opacity: 1, transition: { duration: 0 } }, + gone: { opacity: 0, transition: { duration: 0 } }, + }, + }; + } + return { + backdrop: { + closed: { opacity: 0 }, + open: { opacity: 1, transition: { duration: 0.2, ease: EASE } }, + gone: { opacity: 0, transition: { duration: 0.15, ease: LEAVE } }, + }, + panel: { + closed: { opacity: 0, scale: 0.96, y: 12 }, + open: { + opacity: 1, + scale: 1, + y: 0, + transition: { ...SURFACE, opacity: { duration: 0.16, ease: EASE } }, + }, + + gone: { + opacity: 0, + scale: 0.98, + y: 6, + transition: { duration: 0.15, ease: LEAVE }, + }, + }, + }; + }, [reduced]); + + if (!target) return null; + + return createPortal( + + {open ? ( + + + ) : null} + , + target, + ); +} diff --git a/packages/webui/src/components/pages/login-page.tsx b/packages/webui/src/components/pages/login-page.tsx index 78edfd88..c1007148 100644 --- a/packages/webui/src/components/pages/login-page.tsx +++ b/packages/webui/src/components/pages/login-page.tsx @@ -1,10 +1,10 @@ import { useEffect, useState } from 'react'; import { motion } from 'motion/react'; import { ArrowRight, KeyRound, Sparkles } from 'lucide-react'; +import { Modal } from '@/components/interior/modal'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; -import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { ToggleSwitch } from '@/components/ui/toggle-switch'; import { PasswordVisibilityIcon } from '@/components/ui/password-visibility-icon'; import { ThemeToggle } from '@/components/theme-toggle'; @@ -175,15 +175,15 @@ export function LoginPage({ onLogin }: LoginPageProps) { - - - - 界面有点卡顿? - - 登录页背景是一个跟随鼠标的动态线条效果,在部分设备上可能比较吃性能。可以在这里关掉它——该开关仅作用于本设备的登录页,与系统的动效设置相互独立。 - - - + setHelpOpen(false)} + title="界面有点卡顿?" + description="登录页背景是一个跟随鼠标的动态线条效果,在部分设备上可能比较吃性能。可以在这里关掉它——该开关仅作用于本设备的登录页,与系统的动效设置相互独立。" + closeLabel="关闭性能设置弹窗" + maxWidth={384} + > +

登录页动态背景

@@ -195,8 +195,8 @@ export function LoginPage({ onLogin }: LoginPageProps) {

登录后,你还可以在「系统设置 → 无障碍」里进一步「减弱动效」或「关闭全部动效」。

- -
+ + ); } diff --git a/packages/webui/src/components/pages/overview-page.tsx b/packages/webui/src/components/pages/overview-page.tsx index aa0120e0..99453579 100644 --- a/packages/webui/src/components/pages/overview-page.tsx +++ b/packages/webui/src/components/pages/overview-page.tsx @@ -13,6 +13,7 @@ import { ScrollArea } from '@/components/ui/scroll-area'; import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { SkeletonSwap } from '@/components/interior/skeleton-swap'; +import { Modal } from '@/components/interior/modal'; import { cn, formatBytes, formatUptime } from '@/lib/utils'; import type { AppPath } from '@/router'; import type { @@ -36,7 +37,6 @@ import { type AccountConfig, type AlertsConfig, type ConnectionsConfig, type HostConfig, type LinkConfig, type NoteConfig, type SessionsConfig, } from '@/lib/dashboard-layout'; -import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { DashboardGrid, WIDGET_DRAG_TYPE, type GridCoord } from '@/components/pages/dashboard-grid'; import { AccountConfigForm, AlertsConfigForm, ConnectionsConfigForm, HostConfigForm, @@ -212,11 +212,14 @@ export function OverviewPage() { /> )} - { if (!o) setConfigId(null); }}> - - - {configBlock ? `${widgetLabel(configBlock.id)} · 设置` : '设置'} - + setConfigId(null)} + title={configBlock ? `${widgetLabel(configBlock.id)} · 设置` : '设置'} + closeLabel="关闭卡片设置弹窗" + maxWidth={384} + > +
{configBlock?.id === 'alerts' && setBlockConfig('alerts', c)} />} {configBlock?.id === 'sessions' && setBlockConfig('sessions', c)} />} {configBlock?.id === 'host' && setBlockConfig('host', c)} />} @@ -224,8 +227,8 @@ export function OverviewPage() { {configBlock?.id === 'note' && setBlockConfig('note', c)} />} {configBlock?.id === 'link' && setBlockConfig('link', c)} />} {configBlock?.id === 'account' && setBlockConfig('account', c)} />} - -
+ + ); } diff --git a/packages/webui/src/components/process-probe-dialog.tsx b/packages/webui/src/components/process-probe-dialog.tsx index 10eb1d7c..4b3c9dca 100644 --- a/packages/webui/src/components/process-probe-dialog.tsx +++ b/packages/webui/src/components/process-probe-dialog.tsx @@ -1,14 +1,8 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { Eye, User, UserX } from 'lucide-react'; +import { Modal } from '@/components/interior/modal'; import { SkeletonSwap } from '@/components/interior/skeleton-swap'; import { Button } from '@/components/ui/button'; -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Badge } from '@/components/ui/badge'; import { useApi } from '@/lib/api'; @@ -83,85 +77,82 @@ export function ProcessProbeDialog({ pid, processName, open, onOpenChange, onLoa }, [open, probe]); return ( - - - - 查看登录状态 - - {processName} (PID {pid}) - - - -
- - {!loading ? ( - error ? ( -
- -

{error}

-
- ) : info ? ( -
- {info.loggedIn ? ( -
- - - - - - -
-
- {info.nickName || info.uin} - 已登录 -
-
UIN: {info.uin}
- {info.uid && ( -
+ onOpenChange(false)} + title="查看登录状态" + description={`${processName} (PID ${pid})`} + closeLabel="关闭登录状态弹窗" + > +
+ + {!loading ? ( + error ? ( +
+ +

{error}

+
+ ) : info ? ( +
+ {info.loggedIn ? ( +
+ + + + + + +
+
+ {info.nickName || info.uin} + 已登录 +
+
UIN: {info.uin}
+ {info.uid && ( +
UID: {info.uid} -
- )} -
端口: {info.port}
-
+
+ )} +
端口: {info.port}
- ) : ( -
- -
-

等待登录

-

端口 {info.port} 已响应,但未检测到登录账号

-
+
+ ) : ( +
+ +
+

等待登录

+

端口 {info.port} 已响应,但未检测到登录账号

- )} -
- ) : null - ) : null} -
+
+ )} +
+ ) : null + ) : null} + -
- - {!loading && info?.loggedIn && onLoad && ( - + {!loading && info?.loggedIn && onLoad && ( + - )} - {!loading && ( - - )} -
+ + )} + {!loading && ( + + )}
- -
+ + ); } diff --git a/packages/webui/src/components/settings/notification-channel-dialog.tsx b/packages/webui/src/components/settings/notification-channel-dialog.tsx index 14561af1..6c71cb3f 100644 --- a/packages/webui/src/components/settings/notification-channel-dialog.tsx +++ b/packages/webui/src/components/settings/notification-channel-dialog.tsx @@ -3,15 +3,8 @@ // The channel id is the stable key per-account opt-ins reference, so it's // editable only on create and locked on edit. import { useState } from 'react'; +import { Modal } from '@/components/interior/modal'; import { Button } from '@/components/ui/button'; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Textarea } from '@/components/ui/textarea'; @@ -64,68 +57,15 @@ export function NotificationChannelDialog(props: NotificationChannelDialogProps) const urlError = urlBlank ? '请填写 Webhook URL' : urlBad ? '必须是 http(s) 地址' : undefined; return ( - - - - {isEdit ? '编辑渠道' : '新建渠道'} - 账号上线 / 下线时向该 Webhook POST 一条渲染后的通知。 - - -
-
- patch({ id: v })} - /> - patch({ name: v })} - /> -
- - patch({ url: v })} - /> - -
- -