import { type FormEvent } from "react"; import Icon from "../common/Icon"; import type { ScriptType, Visibility } from "../../services/api"; type NewScriptForm = { name: string; scriptType: ScriptType; visibility: Visibility; parentPath: string; }; type CreateScriptModalProps = { open: boolean; creating: boolean; form: NewScriptForm; scripts: Array<{ script_type: ScriptType; script_name: string }>; onFormChange: (form: NewScriptForm) => void; onSubmit: (event: FormEvent) => void; onClose: () => void; }; export function CreateScriptModal({ open, creating, form, scripts, onFormChange, onSubmit, onClose, }: CreateScriptModalProps) { if (!open) return null; const suffix = form.scriptType === "notebook" ? ".ipynb" : ".py"; const requestedName = form.name.trim(); const normalizedName = requestedName.toLocaleLowerCase().endsWith(suffix) ? requestedName : `${requestedName}${suffix}`; const duplicate = scripts.some((script) => script.script_type === form.scriptType && script.script_name.toLocaleLowerCase() === normalizedName.toLocaleLowerCase() ); return (
工作副本

新建构建脚本

保存到:{form.parentPath || "个人根目录"}
脚本类型
); }