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

Function CommentBox

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

Source from the content-addressed store, hash-verified

19}
20
21function CommentBox({
22 post,
23 comment,
24 origin,
25 parentId,
26 onComment,
27 onShare,
28 onDelete,
29 onEdit,
30 onShowUpvotes,
31 hideOptionsMenu,
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 hideOptionsMenu={hideOptionsMenu}
69 isModalThread={isModalThread}
70 threadRepliesControl={threadRepliesControl}
71 className={
72 isModalThread
73 ? 'pointer-events-auto mt-1 w-full gap-0.5'
74 : 'pointer-events-auto mt-3'
75 }
76 />
77 }
78 {...props}

Callers

nothing calls this directly

Calls 3

useLogContextFunction · 0.90
postLogEventFunction · 0.90
logEventFunction · 0.85

Tested by

no test coverage detected