diff --git a/src/App.tsx b/src/App.tsx index cec3f12..90e4e5b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -333,13 +333,12 @@ function App() { onImportSuccess={handleImportSuccess} /> - {isMcpOpen && ( - setIsMcpOpen(false)} - onNotify={handleNotify} - /> - )} + ); } diff --git a/src/components/mcp/McpFormModal.tsx b/src/components/mcp/McpFormModal.tsx index 36d6c76..a5bcd30 100644 --- a/src/components/mcp/McpFormModal.tsx +++ b/src/components/mcp/McpFormModal.tsx @@ -1,7 +1,6 @@ import React, { useMemo, useState, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { - X, Save, AlertCircle, ChevronDown, @@ -9,6 +8,13 @@ import { AlertTriangle, } from "lucide-react"; import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogFooter, +} from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; import { mcpApi, type AppType } from "@/lib/api"; @@ -495,267 +501,255 @@ const McpFormModal: React.FC = ({ }; return ( -
- {/* Backdrop */} -
+ <> + !open && onClose()}> + + + {getFormTitle()} + - {/* Modal */} -
- {/* Header */} -
-

- {getFormTitle()} -

- -
- - {/* Content - Scrollable */} -
- {/* 预设选择(仅新增时展示) */} - {!isEditing && ( -
- -
- - {mcpPresets.map((preset, idx) => { - const descriptionKey = `mcp.presets.${preset.id}.description`; - return ( - - ); - })} -
-
- )} - {/* ID (标题) */} -
-
- - {!isEditing && idError && ( - - {idError} - - )} -
- handleIdChange(e.target.value)} - disabled={isEditing} - /> -
- - {/* Name */} -
- - setFormName(e.target.value)} - /> -
- - {/* 可折叠的附加信息按钮 */} -
- -
- - {/* 附加信息区域(可折叠) */} - {showMetadata && ( - <> - {/* Description (描述) */} + {/* Content - Scrollable */} +
+ {/* 预设选择(仅新增时展示) */} + {!isEditing && (
-
- - {/* Tags */} -
- - setFormTags(e.target.value)} - /> -
- - {/* Homepage */} -
- - setFormHomepage(e.target.value)} - /> -
- - {/* Docs */} -
- - setFormDocs(e.target.value)} - /> -
- - )} - - {/* 配置输入框(根据格式显示 JSON 或 TOML) */} -
-
- - {(isEditing || selectedPreset === -1) && ( - - )} -
-