import { Menu, MenuItem } from '@mui/material'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemButton from '@mui/material/ListItemButton'; import ListItemIcon from '@mui/material/ListItemIcon'; import ListItemText from '@mui/material/ListItemText'; import ReplyIcon from "./icons8-reply.png"; import ForwardIcon from "./icons8-forward.png"; import { ImgIcon } from './MessageOptions.style'; import EditIcon from '@mui/icons-material/Edit'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import { actionAddDraftMessage, actionSetMessageEditor } from '../../reducers/chatReducer'; import { connect } from 'react-redux'; import { actionModalDraft, actionOpenModal } from '../../reducers/modalReducer'; import { actionEditMessage } from '../../actions/actionsMessages'; const MessageOptions = ({userId, addDraftMessageEditor, handleClose, addMessageId, open, anchorEl, chatId, message, addDraftMessage, openModal}) => { const isOwner = userId === message.owner?._id; return( {handleClose(); addDraftMessage(chatId, message._id)}} disableRipple> Reply {isOwner && {handleClose(); addDraftMessageEditor(chatId, message)}} disableRipple> Edit } {addMessageId(message, 'forwardedMessage'); openModal('searchChatModal'); handleClose()}} disableRipple> Forward {handleClose()}} disableRipple> Delete ) } export default connect(state => ({userId: state?.auth?.payload?.sub?.id}), {addDraftMessage: actionAddDraftMessage, addDraftMessageEditor: actionEditMessage, openModal: actionOpenModal, addMessageId: actionModalDraft})(MessageOptions)