import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import AppearanceEdit_default from "../AppearanceEdit/index.js";
import Modal$1 from "../Modal/index.js";
import React, { useRef } from "react";
import { message } from "antd";
//#region src/components/workSpaceList/components/CreateBaseModal/index.tsx
const CreateBaseModal = (props) => {
	const { open, onCancel, onAddBase } = props;
	const appearanceEditRef = useRef(null);
	const handleAdd = function() {
		var _ref = _asyncToGenerator(function* () {
			var _appearanceEditRef$cu;
			const { name, color, icon } = ((_appearanceEditRef$cu = appearanceEditRef.current) === null || _appearanceEditRef$cu === void 0 ? void 0 : _appearanceEditRef$cu.getDetail()) || {};
			if (!name) {
				message.error("Please fill in the name");
				return;
			}
			yield onAddBase({
				name,
				color,
				icon
			});
			onCancel();
		});
		return function handleAdd() {
			return _ref.apply(this, arguments);
		};
	}();
	return /* @__PURE__ */ React.createElement(Modal$1, {
		open,
		title: "Create a base",
		evenlyButton: false,
		onCancel,
		onOk: handleAdd,
		okText: "Create",
		destroyOnClose: true
	}, /* @__PURE__ */ React.createElement(AppearanceEdit_default, {
		style: { padding: "20px 0px" },
		ref: appearanceEditRef
	}));
};
//#endregion
export { CreateBaseModal as default };
