// Components import Menu from "@mui/material/Menu"; import IconButton from "@mui/material/IconButton"; import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined"; import MenuItem from "@mui/material/MenuItem"; // Utils import { useState } from "react"; import { useTheme } from "@emotion/react"; import { useNavigate } from "react-router-dom"; import PropTypes from "prop-types"; import { useTranslation } from "react-i18next"; const ActionMenu = ({ notification, onDelete }) => { const theme = useTheme(); const navigate = useNavigate(); const [anchorEl, setAnchorEl] = useState(null); const open = Boolean(anchorEl); const { t } = useTranslation(); // Handlers const handleClick = (event) => { event.stopPropagation(); setAnchorEl(event.currentTarget); }; const handleClose = (event) => { if (event) { event.stopPropagation(); } setAnchorEl(null); }; const handleRemove = (e) => { e.stopPropagation(); onDelete(notification._id); handleClose(); }; const handleConfigure = (e) => { e.stopPropagation(); navigate(`/notifications/${notification._id}`); handleClose(); }; return ( <> e.stopPropagation()} > e.stopPropagation()} onMouseDown={(e) => e.stopPropagation()} > {t("configure")} {t("delete")} ); }; ActionMenu.propTypes = { notification: PropTypes.object, onDelete: PropTypes.func, }; export default ActionMenu;