addEmoji(native)}
/>
)}
{
setComment(e.target.value)
}}
onPressEnter={(e) => {
setComment(e.target.value)
}}
/>
{
!showEmojiPicker ?
:
}
>
)
}
export const SpoilerButton = ({ text, close, children, style }) => {
const [opened, setOpened] = useState(close)
return (
<>
{opened && children}
>
)
}
const CommentForReply = ({ addCommentReply, commentId, postId }) => {
const [comment, setComment] = useState('')
return (
<>
{
setComment(e.target.value)
}}
/>
>
)
}
const CommentData = ({ createdAt }) => {
return (
{moment(new Date(+createdAt))
.startOf()
.fromNow()}
)
}
export const Comments = ({
comments,
postId,
commentsFind,
addCommentReply,
children,
close,
findSubComment,
onGetLikes,
onGetType
}) => {
const [opened, setOpened] = useState(close)
return (
<>
{comments
?
comments?.map((comment) => (
{comment?.owner?.login || 'Anon'}
}
avatar=
{comment.owner?.avatar ? (
) : (
)}
content=
{
{comment?.text}
}
datetime={
}
/>
)) : No comments
}
>)
}
export const CComments = connect(
(state) => ({
postId: state.promise.onePost?.payload?._id,
addComment: state.promise?.addComment?.payload,
addSubComment: state.promise?.addSubComment,
}),
{
addCommentReply: actionAddSubFullComment,
findSubComment: actionFindSubComment,
},
)(Comments)