feat: prefill agent-edit modal, Ctrl+Enter submits modals, improve README
- AgentFormModal: sync form state to current agent values when the modal opens (useEffect on open/agent), so edit always shows the agent's current name, description, website, icon URL, and max-pending value. - Modal: add optional onSubmit prop; Ctrl+Enter (or ⌘+Enter) fires it, covering AgentFormModal, DecisionModal, and both Settings modals (disable 2FA, delete account) without breaking textarea newlines or text-input behaviour. - README: substantially expanded — purpose, capabilities, architecture, quick-start with Docker Compose, dev setup, testing, agent integration (OpenClaw, generic MCP, REST), and privacy notes. - TODO.md: remove three completed items (prefill modal, Ctrl+Enter, human readme). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { ReactNode, useEffect } from "react";
|
||||
export function Modal({
|
||||
open,
|
||||
onClose,
|
||||
onSubmit,
|
||||
title,
|
||||
children,
|
||||
footer,
|
||||
@@ -10,6 +11,7 @@ export function Modal({
|
||||
}: {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onSubmit?: () => void;
|
||||
title: string;
|
||||
children: ReactNode;
|
||||
footer?: ReactNode;
|
||||
@@ -19,6 +21,7 @@ export function Modal({
|
||||
if (!open) return;
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape") onClose();
|
||||
if (e.key === "Enter" && (e.ctrlKey || e.metaKey) && onSubmit) onSubmit();
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
document.body.style.overflow = "hidden";
|
||||
@@ -26,7 +29,7 @@ export function Modal({
|
||||
window.removeEventListener("keydown", onKey);
|
||||
document.body.style.overflow = "";
|
||||
};
|
||||
}, [open, onClose]);
|
||||
}, [open, onClose, onSubmit]);
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user