From 67f8bcfecac0c7837170e1c3ae503a088b0e274f Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Thu, 3 Jul 2025 20:52:22 -0700 Subject: [PATCH] comment ui permissions --- .../comment/components/comment-list-item.tsx | 28 ++- .../components/comment-list-with-tabs.tsx | 63 +++++-- .../comment/components/comment-list.tsx | 162 ------------------ 3 files changed, 68 insertions(+), 185 deletions(-) delete mode 100644 apps/client/src/features/comment/components/comment-list.tsx diff --git a/apps/client/src/features/comment/components/comment-list-item.tsx b/apps/client/src/features/comment/components/comment-list-item.tsx index 41b2f659..b34dbd35 100644 --- a/apps/client/src/features/comment/components/comment-list-item.tsx +++ b/apps/client/src/features/comment/components/comment-list-item.tsx @@ -23,9 +23,14 @@ import { useTranslation } from "react-i18next"; interface CommentListItemProps { comment: IComment; pageId: string; + canComment: boolean; } -function CommentListItem({ comment, pageId }: CommentListItemProps) { +function CommentListItem({ + comment, + pageId, + canComment, +}: CommentListItemProps) { const { t } = useTranslation(); const { hovered, ref } = useHover(); const [isEditing, setIsEditing] = useState(false); @@ -39,7 +44,7 @@ function CommentListItem({ comment, pageId }: CommentListItemProps) { const isCloudEE = useIsCloudEE(); useEffect(() => { - setContent(comment.content) + setContent(comment.content); }, [comment]); async function handleUpdateComment() { @@ -78,7 +83,9 @@ function CommentListItem({ comment, pageId }: CommentListItemProps) { } function handleCommentClick(comment: IComment) { - const el = document.querySelector(`.comment-mark[data-comment-id="${comment.id}"]`); + const el = document.querySelector( + `.comment-mark[data-comment-id="${comment.id}"]`, + ); if (el) { el.scrollIntoView({ behavior: "smooth", block: "center" }); el.classList.add("comment-highlight"); @@ -111,12 +118,12 @@ function CommentListItem({ comment, pageId }: CommentListItemProps) {