diff --git a/frontend_nuxt/components/CommentItem.vue b/frontend_nuxt/components/CommentItem.vue index b47456dda..4c260fd5a 100644 --- a/frontend_nuxt/components/CommentItem.vue +++ b/frontend_nuxt/components/CommentItem.vue @@ -53,14 +53,29 @@ @click="handleContentClick" >
- -
+ +
+ +
-
authState.loggedIn) +const commentReactionsGroupRef = ref(null) +const commentLikeCount = computed( + () => (props.comment.reactions || []).filter((reaction) => reaction.type === 'LIKE').length, +) +const commentLikedByMe = computed(() => + (props.comment.reactions || []).some( + (reaction) => reaction.type === 'LIKE' && reaction.user === authState.username, + ), +) +const toggleCommentLike = () => { + commentReactionsGroupRef.value?.toggleReaction('LIKE') +} const countReplies = (list) => list.reduce((sum, r) => sum + 1 + countReplies(r.reply || []), 0) const replyCount = computed(() => countReplies(props.comment.reply || [])) const isCommentFromPostAuthor = computed(() => { @@ -365,6 +392,56 @@ const handleContentClick = (e) => {