const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../Card/index.js");
const require_index$1 = require("../CreateBaseModal/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_materials = require("@pisell/materials");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/workSpaceList/components/CardList/index.tsx
const Empty = (props) => {
	const { onAddBase } = props;
	const [open, setOpen] = (0, react.useState)(false);
	return /* @__PURE__ */ react.default.createElement("div", { className: "styles-empty" }, /* @__PURE__ */ react.default.createElement("div", null, "This workspace is empty"), /* @__PURE__ */ react.default.createElement("div", null, "Get started by creating a new base"), /* @__PURE__ */ react.default.createElement(_pisell_materials.Button, {
		type: "primary",
		onClick: () => setOpen(true)
	}, "Create a base"), /* @__PURE__ */ react.default.createElement(require_index$1.default, {
		onAddBase,
		open,
		onCancel: () => setOpen(false)
	}));
};
const CardList = (props) => {
	const { data, onAddBase, onRefresh, onDeleteBase, onUpdateBase, scrollRef, isDetail } = props;
	return /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)({
			"card-list-wrap": !!data.length,
			"card-list-in-workspace": !isDetail
		}),
		ref: scrollRef
	}, !data.length ? /* @__PURE__ */ react.default.createElement(Empty, { onAddBase }) : data.map((item) => /* @__PURE__ */ react.default.createElement(require_index.default, {
		id: item.id,
		key: item.name,
		icon: item.icon,
		color: item.color,
		describe: item.describe,
		name: item.name,
		created_at: item.created_at,
		onRefresh,
		onDeleteBase,
		onUpdateBase
	})));
};
//#endregion
exports.default = CardList;
