/** * A small modal confirmation, local to the plugins feature (ticket #43, F2). * Mirrors `features/devices/ConfirmDialog` (not shared — that dialog is itself * feature-local by design, see its header comment); duplicated rather than * cross-imported to keep each feature's public surface to its own `index.ts`. */ import { useEffect, useRef } from "react"; import { Button, zIndex } from "@/shared"; interface PluginConfirmDialogProps { title: string; body: string; confirmLabel: string; danger?: boolean; busy?: boolean; onConfirm: () => void | Promise; onCancel: () => void; } export function PluginConfirmDialog({ title, body, confirmLabel, danger = false, busy = false, onConfirm, onCancel, }: PluginConfirmDialogProps) { const cancelRef = useRef(null); useEffect(() => { cancelRef.current?.focus(); }, []); useEffect(() => { function onKeyDown(e: KeyboardEvent) { if (e.key === "Escape") onCancel(); } window.addEventListener("keydown", onKeyDown); return () => window.removeEventListener("keydown", onKeyDown); }, [onCancel]); return (
e.stopPropagation()} className="flex w-full max-w-md flex-col gap-3 rounded-lg border border-border bg-raised p-4 shadow-xl" >

{title}

{body}

); }