const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_index = require("../AppearanceEdit/index.js");
const require_index$1 = require("../Modal/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
//#region src/components/workSpaceList/components/CreateBaseModal/index.tsx
const CreateBaseModal = (props) => {
	const { open, onCancel, onAddBase } = props;
	const appearanceEditRef = (0, react.useRef)(null);
	const handleAdd = function() {
		var _ref = require_asyncToGenerator._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) {
				antd.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.default.createElement(require_index$1.default, {
		open,
		title: "Create a base",
		evenlyButton: false,
		onCancel,
		onOk: handleAdd,
		okText: "Create",
		destroyOnClose: true
	}, /* @__PURE__ */ react.default.createElement(require_index.default, {
		style: { padding: "20px 0px" },
		ref: appearanceEditRef
	}));
};
//#endregion
exports.default = CreateBaseModal;
