import { jsx } from "react/jsx-runtime";
import { useProjectSlug } from "@contember/react-client";
import { LayoutPage, Heading } from "@contember/ui";
import { createNotInProjectError } from "./errors.js";
import { useRoleRendererFactory, UsersList } from "../person/UsersList.js";
import { LinkButton } from "../../../routing/LinkButton.js";
const UserListPage = (props) => {
  const project = useProjectSlug();
  const roleRendererFactory = useRoleRendererFactory(props);
  if (!project) {
    throw createNotInProjectError();
  }
  return /* @__PURE__ */ jsx(
    LayoutPage,
    {
      actions: /* @__PURE__ */ jsx(LinkButton, { to: props.addUserLink ?? "tenantInviteUser", children: "Add a user" }),
      title: /* @__PURE__ */ jsx(Heading, { depth: 1, children: "Users" }),
      children: /* @__PURE__ */ jsx(
        UsersList,
        {
          project,
          createRoleRenderer: roleRendererFactory,
          editUserLink: props.editUserLink ?? `tenantEditUser(id: $identityId)`
        }
      )
    }
  );
};
const UsersManagement = UserListPage;
export {
  UserListPage,
  UsersManagement
};
//# sourceMappingURL=UserListPage.js.map
