You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

81 lines
2.7 KiB

import React, { Component } from "react";
import DoneIcon from "@material-ui/icons/Done";
import DoneAllIcon from "@material-ui/icons/DoneAll";
import EditIcon from "@material-ui/icons/Edit";
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
import "./index.scss";
import Menu from "@material-ui/core/Menu";
import MenuItem from "@material-ui/core/MenuItem";
import ReplyIcon from "@material-ui/icons/Reply";
import ForwardIcon from "@material-ui/icons/Forward";
import DeleteIcon from "@material-ui/icons/Delete";
import ScheduleIcon from "@material-ui/icons/Schedule";
const menu = [
{ text: window.t("پسند"), icon: FavoriteIcon, onClick: () => {} },
{ text: window.t("تبادل نظر"), icon: TextsmsIcon, onClick: () => {} },
{ text: window.t("پاسخ"), icon: ReplyIcon, onClick: () => {} },
{ text: window.t("باز ارسال"), icon: ForwardIcon, onClick: () => {} },
];
const selfMenu = [
{ text: window.t("باز ارسال"), icon: ForwardIcon, onClick: () => {} },
{ text: window.t("ویرایش"), icon: EditIcon, onClick: () => {} },
{ text: window.t("حذف")), icon: DeleteIcon, onClick: () => {} },
];
export default class Comment extends Component {
state = { messageMenu: null };
handleClose = () => {
this.setState({
messageMenu: null,
});
};
handleClick = (event) => {
this.setState({
messageMenu: event.currentTarget,
});
};
render() {
const { message, user, document, children, addcounter } = this.props;
const { messageMenu } = this.state;
const hasavatar = prevUserId != message.userId;
return (
<div
className="comment-message d-flex flex-column d-flex"
style={{
filter: document !== null ? "blur(4px)" : "blur(0px)",
}}
>
<div className={`comment-message__box`}>
<div className="comment-message__box--detail d-flex">
<div onClick={() => addcounter("nothing")}>
<ExpandMoreIcon fontSize="small" onClick={this.handleClick} />
</div>
<Menu
anchorEl={messageMenu}
keepMounted
open={Boolean(messageMenu)}
onClose={() => this.handleClose()}
className="rtl fontLight"
>
{(isSelf ? selfMenu : menu).map((e) => (
<MenuItem
className="fontLight"
onClick={() => {
this.handleClose();
e.onClick();
addcounter("nothing");
}}
>
<e.icon fontSize="small" />
{e.text}
</MenuItem>
))}
</Menu>
</div>
<p>{message.text}</p>
</div>
</div>
);
}
}