-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCommentTree.tsx
43 lines (41 loc) · 1.35 KB
/
CommentTree.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { CommentNode } from "@/app/comment/commentActions";
import { Comment } from "@/app/comment/Comment";
import classNames from "classnames";
import { VoteConfig } from "@/app/(ui)/vote/getVoteConfig";
import { memo } from "react";
import { MyUserInfo } from "lemmy-js-client";
export const CommentTree = memo(
(props: {
readonly node: CommentNode;
readonly highlightRoot?: boolean;
readonly voteConfig: VoteConfig;
readonly loggedInUser?: MyUserInfo;
readonly renderedDepth?: number;
}) => {
return (
<div
className={classNames("group mt-4 border-neutral-700", {
"border-l": !!props.node.parent,
"border-t pt-4": !props.node.parent,
})}
>
<Comment
commentView={props.node.commentView}
highlight={props.highlightRoot}
loggedInUser={props.loggedInUser}
markdown={props.node.markdown}
node={props.node}
parentId={props.node.parent?.commentView.comment.id}
renderedDepth={props.renderedDepth}
voteConfig={props.voteConfig}
/>
</div>
);
},
(prevProps, newProps) =>
prevProps.node.commentView.comment.id ===
newProps.node.commentView.comment.id &&
prevProps.node.commentView.counts.score ===
newProps.node.commentView.counts.score,
);
CommentTree.displayName = "CommentTree";