import Card$1 from "../Card/index.js";
import CreateBaseModal from "../CreateBaseModal/index.js";
import React, { useState } from "react";
import { Button } from "@pisell/materials";
import classNames from "classnames";
import "./index.less";
//#region src/components/workSpaceList/components/CardList/index.tsx
const Empty$1 = (props) => {
	const { onAddBase } = props;
	const [open, setOpen] = useState(false);
	return /* @__PURE__ */ React.createElement("div", { className: "styles-empty" }, /* @__PURE__ */ React.createElement("div", null, "This workspace is empty"), /* @__PURE__ */ React.createElement("div", null, "Get started by creating a new base"), /* @__PURE__ */ React.createElement(Button, {
		type: "primary",
		onClick: () => setOpen(true)
	}, "Create a base"), /* @__PURE__ */ React.createElement(CreateBaseModal, {
		onAddBase,
		open,
		onCancel: () => setOpen(false)
	}));
};
const CardList = (props) => {
	const { data, onAddBase, onRefresh, onDeleteBase, onUpdateBase, scrollRef, isDetail } = props;
	return /* @__PURE__ */ React.createElement("div", {
		className: classNames({
			"card-list-wrap": !!data.length,
			"card-list-in-workspace": !isDetail
		}),
		ref: scrollRef
	}, !data.length ? /* @__PURE__ */ React.createElement(Empty$1, { onAddBase }) : data.map((item) => /* @__PURE__ */ React.createElement(Card$1, {
		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
export { CardList as default };
