import { useProjectSlug } from "@contember/react-client";
import { createNotInProjectError } from "./errors.js";
import { LayoutPage } from "@contember/ui";
import { jsx } from "react/jsx-runtime";
import { useRoleRendererFactory, UsersList } from "../person/UsersList.js";
import { LinkButton } from "../../../routing/binding/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: "Users in project",
    children: /* @__PURE__ */ jsx(UsersList, {
      project,
      createRoleRenderer: roleRendererFactory,
      editUserLink: props.editUserLink ?? `tenantEditUser(id: $id)`
    })
  });
};
const UsersManagement = UserListPage;
export {
  UserListPage,
  UsersManagement
};
//# sourceMappingURL=UserListPage.js.map
