MCPcopy Create free account
hub / github.com/dailydotdev/apps / CommentBox

Function CommentBox

packages/shared/src/components/comments/CommentBox.tsx:22–83  ·  view source on GitHub ↗
({
  post,
  comment,
  origin,
  parentId,
  onComment,
  onShare,
  onDelete,
  onEdit,
  onShowUpvotes,
  isModalThread = false,
  threadRepliesControl,
  children,
  ...props
}: CommentBoxProps)

Source from the content-addressed store, hash-verified

20}
21
22function 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}

Callers

nothing calls this directly

Calls 4

useLogContextFunction · 0.90
postLogEventFunction · 0.90
useInViewFunction · 0.85
logEventFunction · 0.85

Tested by

no test coverage detected