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

Function SubComment

packages/shared/src/components/comments/SubComment.tsx:29–138  ·  view source on GitHub ↗
({
  comment,
  parentComment,
  className,
  onCommented,
  isModalThread = false,
  isFirst = false,
  isLast = false,
  extendTopConnector = false,
  ...props
}: SubCommentProps)

Source from the content-addressed store, hash-verified

27}
28
29function SubComment({
30 comment,
31 parentComment,
32 className,
33 onCommented,
34 isModalThread = false,
35 isFirst = false,
36 isLast = false,
37 extendTopConnector = false,
38 ...props
39}: SubCommentProps): ReactElement {
40 const { inputProps, commentId, onReplyTo } = useComments(props.post);
41 const { inputProps: editProps, onEdit } = useEditCommentProps();
42
43 return (
44 <>
45 {!editProps && (
46 <CommentBox
47 {...props}
48 key={comment.id}
49 parentId={parentComment.id}
50 comment={comment}
51 onEdit={({ id, lastUpdatedAt }) =>
52 onEdit({
53 commentId: id,
54 lastUpdatedAt,
55 parentCommentId: parentComment.id,
56 })
57 }
58 className={{
59 container: classNames(
60 'relative',
61 isModalThread &&
62 'rounded-none bg-transparent px-0 py-2 hover:bg-transparent',
63 isModalThread && !isLast && 'mb-1',
64 ),
65 content: classNames('ml-[52px]', isModalThread && 'mt-1'),
66 markdown: classNames(
67 isModalThread &&
68 '!text-[0.9375rem] [&_a]:!text-[0.9375rem] [&_li]:!text-[0.9375rem] [&_li]:!leading-[1.55] [&_p]:!text-[0.9375rem] [&_p]:!leading-[1.55]',
69 ),
70 }}
71 onComment={(selected, parent) =>
72 onReplyTo({
73 username: comment.author?.username ?? null,
74 parentCommentId: parent,
75 commentId: selected.id,
76 })
77 }
78 isModalThread={isModalThread}
79 >
80 {!isModalThread && (
81 <div
82 className="absolute bottom-0 left-9 top-0 -ml-px w-0.5 bg-surface-float"
83 data-testid="subcomment"
84 />
85 )}
86 {isModalThread && (

Callers

nothing calls this directly

Calls 4

useCommentsFunction · 0.90
useEditCommentPropsFunction · 0.90
onEditFunction · 0.85
onCommentedFunction · 0.85

Tested by

no test coverage detected