import React from "react"; import { CommentNode } from "@/server/db/schema"; import Avatar from "../avatar"; import { formatCommentDate } from "@/lib/utils/format"; import { Button } from "../ui/button"; import CommentEditor from "../editor/comment-editor"; import CommentVoteButton from "./comment-vote-button"; import { Session } from "next-auth"; import { Badge } from "../ui/badge"; import CommentDeleteButton from "./comment-delete-button"; import { cn } from "@/lib/utils"; const Comment = React.memo( (props: { comment: CommentNode; setReplyComment: (comment: CommentNode) => void; setRef: (el: HTMLDivElement | null) => void; session: Session | null; level?: number; }) => { const { comment, setReplyComment, setRef, session, level = 0 } = props; const isAuthor = session?.user?.id === comment?.author?.id; return (