diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ManageButton.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ManageButton.js index 04736c470..4184fe3c9 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ManageButton.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ManageButton.js @@ -5,11 +5,13 @@ // under the terms of the MIT License; see LICENSE file for more details. import React from "react"; -import { Dropdown } from "semantic-ui-react"; +import { Dropdown, Modal, Button, Message } from "semantic-ui-react"; import { i18next } from "@translations/invenio_app_rdm/i18next"; import PropTypes from "prop-types"; +import { http } from "react-invenio-forms"; +import { APIRoutes } from "../administration/users/api/routes"; -export const ManageButton = ({ recid, recordOwnerUsername }) => { +export const ManageButton = ({ recid, recordOwnerUsername, recordOwnerId }) => { return ( { key="manage_user" text={i18next.t("Manage user")} /> + + {recordOwnerId && } ); @@ -43,4 +47,62 @@ export const ManageButton = ({ recid, recordOwnerUsername }) => { ManageButton.propTypes = { recid: PropTypes.string.isRequired, recordOwnerUsername: PropTypes.string.isRequired, + recordOwnerId: PropTypes.string.isRequired, +}; + +const BlockUserItem = ({ recordOwnerId }) => { + const [modalOpen, setModalOpen] = React.useState(false); + const handleOpen = () => setModalOpen(true); + const handleClose = () => setModalOpen(false); + const blockUser = () => { + http.post(APIRoutes.block({ id: recordOwnerId })); + handleClose(); + }; + + return ( + <> + + + {i18next.t("Block User")} + + + + + +