({
post,
comment,
origin,
parentId,
onComment,
onShare,
onDelete,
onEdit,
onShowUpvotes,
isModalThread = false,
threadRepliesControl,
children,
...props
}: CommentBoxProps)
| 20 | } |
| 21 | |
| 22 | function CommentBox({ |
| 23 | post, |
| 24 | comment, |
| 25 | origin, |
| 26 | parentId, |
| 27 | onComment, |
| 28 | onShare, |
| 29 | onDelete, |
| 30 | onEdit, |
| 31 | onShowUpvotes, |
| 32 | isModalThread = false, |
| 33 | threadRepliesControl, |
| 34 | children, |
| 35 | ...props |
| 36 | }: CommentBoxProps): ReactElement { |
| 37 | const { logEvent } = useLogContext(); |
| 38 | const { ref: inViewRef, inView } = useInView({ |
| 39 | threshold: 0.5, |
| 40 | }); |
| 41 | useEffect(() => { |
| 42 | if (inView) { |
| 43 | logEvent( |
| 44 | postLogEvent(LogEvent.ImpressionComment, post, { |
| 45 | extra: { commentId: comment.id }, |
| 46 | }), |
| 47 | ); |
| 48 | } |
| 49 | }, [inView, comment, logEvent, post]); |
| 50 | |
| 51 | return ( |
| 52 | <> |
| 53 | <span ref={inViewRef} /> |
| 54 | <CommentContainer |
| 55 | post={post} |
| 56 | comment={comment} |
| 57 | actions={ |
| 58 | <CommentActionButtons |
| 59 | post={post} |
| 60 | comment={comment} |
| 61 | origin={origin} |
| 62 | parentId={parentId ?? null} |
| 63 | onShare={onShare} |
| 64 | onComment={onComment} |
| 65 | onDelete={onDelete} |
| 66 | onEdit={onEdit} |
| 67 | onShowUpvotes={onShowUpvotes} |
| 68 | isModalThread={isModalThread} |
| 69 | threadRepliesControl={threadRepliesControl} |
| 70 | className={ |
| 71 | isModalThread |
| 72 | ? 'pointer-events-auto mt-1 w-full gap-0.5' |
| 73 | : 'pointer-events-auto mt-3' |
| 74 | } |
| 75 | /> |
| 76 | } |
| 77 | {...props} |
| 78 | > |
| 79 | {children} |
nothing calls this directly
no test coverage detected