resolve conversation

This commit is contained in:
ilya-bkv 2022-12-17 06:11:34 +03:00
parent 1ddfc8e9a5
commit a5ae274c3e
2 changed files with 4 additions and 24 deletions

View File

@ -3,7 +3,6 @@
margin: 0 -2.4rem 1.5em;
padding: 0.8rem 2.4rem;
transition: background-color 0.3s;
border: 1px solid red;
&:hover {
background-color: #f6f6f6;
@ -33,26 +32,6 @@
}
}
//.commentLevel1 {
// margin-left: 3.2rem;
//}
//
//.commentLevel2 {
// margin-left: 6.4rem;
//}
//
//.commentLevel3 {
// margin-left: 9.6rem;
//}
//
//.commentLevel4 {
// margin-left: 12.8rem;
//}
//
//.commentLevel5 {
// margin-left: 16rem;
//}
.commentControls {
@include font-size(1.2rem);
margin-bottom: 0.5em;

View File

@ -56,15 +56,16 @@ export const CommentsTree = (props: { shoutSlug: string }) => {
function nestComments(commentList) {
const commentMap = {}
commentList.forEach((comment) => (commentMap[comment.id] = comment))
commentList.forEach((comment) => {
if (comment.replyTo !== null) {
commentMap[comment.id] = comment
if (comment.replyTo) {
if (!comment.replyTo) return
const parent = commentMap[comment.replyTo]
;(parent.children = parent.children || []).push(comment)
}
})
return commentList.filter((comment) => {
return comment.replyTo === null
return !comment.replyTo
})
}