import { actionAddFullComment, actionFindSubComment, actionAddSubFullComment, } from '../actions' import { Tooltip } from 'antd' import { connect } from 'react-redux' import { Link } from 'react-router-dom' import { Input, Button } from 'antd' import { SmileOutlined } from '@ant-design/icons' import moment from 'moment' import React, { useRef, useEffect, useState } from 'react' import 'emoji-mart/css/emoji-mart.css' import { Picker } from 'emoji-mart' import data from 'emoji-mart/data/google.json' import { NimblePicker, Emoji } from 'emoji-mart' import { LinkToUser } from './LinkToUser' import reactStringReplace from 'react-string-replace' import { Comment,Avatar } from 'antd'; import user from '../materials/user.png' // import EmojiSelector from 'react-native-emoji-selector' // render(, document.querySelector('#picker')) import { ConstructorModal } from '../helpers' export const AddComment = ({ addComment, postId }) => { const [text, setComment] = useState('') const [showEmojiPicker, setShowEmojiPicker] = useState(false) console.log('show stickers', showEmojiPicker) const handleOK = () => setShowEmojiPicker(!showEmojiPicker) const addEmoji = ({ native }) => setComment((text + ' ' + native).trim()) return ( <> {showEmojiPicker && ( 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)