|
|
|
@ -4,6 +4,9 @@ import { addComment, getPosts } from '../../actions/post.actions';
|
|
|
|
|
import FollowHandler from '../UserProfil/FollowHandler';
|
|
|
|
|
import { isEmpty, timestampParser } from '../Utils';
|
|
|
|
|
import ActionComment from './ActionComment';
|
|
|
|
|
import MiniProfil from "../MiniProfil";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Comment = ({ post }) => {
|
|
|
|
|
const [message, setMessage] = useState("");
|
|
|
|
@ -27,36 +30,22 @@ const Comment = ({ post }) => {
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={
|
|
|
|
|
comment.commenterId === userData._id
|
|
|
|
|
comment.commentId === userData._id
|
|
|
|
|
? "comment-container client"
|
|
|
|
|
: "comment-container"
|
|
|
|
|
}
|
|
|
|
|
key={comment._id}
|
|
|
|
|
>
|
|
|
|
|
<div className="left-part">
|
|
|
|
|
<img
|
|
|
|
|
src={
|
|
|
|
|
!isEmpty(usersData[0]) &&
|
|
|
|
|
usersData
|
|
|
|
|
.map((user) => {
|
|
|
|
|
if (user._id === comment.commenterId) return user.picture;
|
|
|
|
|
else return null;
|
|
|
|
|
})
|
|
|
|
|
.join("")
|
|
|
|
|
}
|
|
|
|
|
alt="commenter-pic"
|
|
|
|
|
/>
|
|
|
|
|
<MiniProfil uid={comment.commentId}/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="right-part">
|
|
|
|
|
<div className="comment-header">
|
|
|
|
|
<div className="pseudo">
|
|
|
|
|
<h3>{comment.commenterPseudo}</h3>
|
|
|
|
|
{comment.commenterId !== userData._id && (
|
|
|
|
|
<FollowHandler
|
|
|
|
|
idToFollow={comment.commenterId}
|
|
|
|
|
<FollowHandler
|
|
|
|
|
idToFollow={comment.commentId}
|
|
|
|
|
type={"suggest"}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
<span>{timestampParser(comment.timestamp)}</span>
|
|
|
|
|
</div>
|
|
|
|
|