import { track } from '@amplitude/analytics-browser' import { Editor } from '@tiptap/core' import clsx from 'clsx' import { PostComment } from 'common/comment' import { Post } from 'common/post' import { Dictionary } from 'lodash' import { useRouter } from 'next/router' import { useEffect, useState } from 'react' import { Avatar } from 'web/components/avatar' import { CommentInput } from 'web/components/comment-input' import { Content } from 'web/components/editor' import { CopyLinkDateTimeComponent } from 'web/components/feed/copy-link-date-time' import { Col } from 'web/components/layout/col' import { Row } from 'web/components/layout/row' import { Tipper } from 'web/components/tipper' import { UserLink } from 'web/components/user-link' import { CommentTipMap, CommentTips } from 'web/hooks/use-tip-txns' import { useUser } from 'web/hooks/use-user' import { createCommentOnPost } from 'web/lib/firebase/comments' import { firebaseLogin } from 'web/lib/firebase/users' export function PostCommentThread(props: { post: Post threadComments: PostComment[] tips: CommentTipMap parentComment: PostComment commentsByUserId: Dictionary }) { const { post, threadComments, tips, parentComment } = props const [showReply, setShowReply] = useState(false) const [replyTo, setReplyTo] = useState<{ id: string; username: string }>() function scrollAndOpenReplyInput(comment: PostComment) { setReplyTo({ id: comment.userId, username: comment.userUsername }) setShowReply(true) } return (