diff --git a/src/components/providers/forms/CodexCommonConfigModal.tsx b/src/components/providers/forms/CodexCommonConfigModal.tsx new file mode 100644 index 0000000..c836972 --- /dev/null +++ b/src/components/providers/forms/CodexCommonConfigModal.tsx @@ -0,0 +1,126 @@ +import React, { useEffect } from "react"; +import { X, Save } from "lucide-react"; +import { useTranslation } from "react-i18next"; +import { isLinux } from "@/lib/platform"; + +interface CodexCommonConfigModalProps { + isOpen: boolean; + onClose: () => void; + value: string; + onChange: (value: string) => void; + error?: string; +} + +/** + * CodexCommonConfigModal - Common Codex configuration editor modal + * Allows editing of common TOML configuration shared across providers + */ +export const CodexCommonConfigModal: React.FC = ({ + isOpen, + onClose, + value, + onChange, + error, +}) => { + const { t } = useTranslation(); + + // Support ESC key to close modal + useEffect(() => { + if (!isOpen) return; + + const onKeyDown = (e: KeyboardEvent) => { + if (e.key === "Escape") { + e.preventDefault(); + onClose(); + } + }; + + window.addEventListener("keydown", onKeyDown); + return () => window.removeEventListener("keydown", onKeyDown); + }, [isOpen, onClose]); + + if (!isOpen) return null; + + return ( +
{ + if (e.target === e.currentTarget) onClose(); + }} + > + {/* Backdrop */} +
+ + {/* Modal */} +
+ {/* Header */} +
+

+ {t("codexConfig.editCommonConfigTitle")} +

+ +
+ + {/* Content */} +
+

+ {t("codexConfig.commonConfigHint")} +

+ +