diff --git a/src/App.tsx b/src/App.tsx index 90e4e5b..ccf1367 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -304,6 +304,7 @@ function App() { setUsageProvider(null)} onSave={(script) => { void handleSaveUsageScript(usageProvider, script); diff --git a/src/components/UsageScriptModal.tsx b/src/components/UsageScriptModal.tsx index c08c8ea..d6d2c02 100644 --- a/src/components/UsageScriptModal.tsx +++ b/src/components/UsageScriptModal.tsx @@ -1,15 +1,24 @@ import React, { useState } from "react"; -import { X, Play, Wand2 } from "lucide-react"; +import { Play, Wand2 } from "lucide-react"; import { Provider, UsageScript } from "../types"; import { usageApi, type AppType } from "@/lib/api"; import JsonEditor from "./JsonEditor"; import * as prettier from "prettier/standalone"; import * as parserBabel from "prettier/parser-babel"; import * as pluginEstree from "prettier/plugins/estree"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogFooter, +} from "@/components/ui/dialog"; +import { Button } from "@/components/ui/button"; interface UsageScriptModalProps { provider: Provider; appType: AppType; + isOpen: boolean; onClose: () => void; onSave: (script: UsageScript) => void; onNotify?: ( @@ -79,6 +88,7 @@ const PRESET_TEMPLATES: Record = { const UsageScriptModal: React.FC = ({ provider, appType, + isOpen, onClose, onSave, onNotify, @@ -162,23 +172,14 @@ const UsageScriptModal: React.FC = ({ }; return ( -
-
- {/* Header */} -
-

- 配置用量查询 - {provider.name} -

- -
+ !open && onClose()}> + + + 配置用量查询 - {provider.name} + - {/* Content */} -
+ {/* Content - Scrollable */} +
{/* 启用开关 */}
{/* Footer */} -
+ + {/* Left side - Test and Format buttons */}
- - +
+ {/* Right side - Cancel and Save buttons */}
- - + +
-
-
-
+ + + ); };