feat: comments

* create comment
* reply to comment thread
* edit comment
* delete comment
* resolve comment
This commit is contained in:
Philipinho
2023-11-09 16:52:34 +00:00
parent dea2cad89c
commit 4cb7a56f65
49 changed files with 1486 additions and 87 deletions
+19
View File
@@ -0,0 +1,19 @@
export function scrollToComment(commentId) {
const selector = `div[data-comment-id="${commentId}"]`;
const commentElement = document.querySelector(selector);
if (commentElement) {
commentElement.scrollIntoView({ behavior: 'smooth' });
}
}
export const scrollToCommentInScrollArea = (commentId, scrollAreaRef) => {
const commentElement = scrollAreaRef.current.querySelector(`[data-comment-id="${commentId}"]`);
if (commentElement) {
const scrollArea = scrollAreaRef.current;
const commentTop = commentElement.offsetTop;
const scrollAreaTop = scrollArea.offsetTop;
scrollArea.scrollTop = commentTop - scrollAreaTop;
}
};