delete comment / reply working

This commit is contained in:
isUnknown 2024-10-30 16:32:13 +01:00
parent 58c08690f8
commit ac48b4166a
5 changed files with 131 additions and 59 deletions

View file

@ -10,6 +10,8 @@
:commentIndex="comments.length - commentIndex"
:key="comment.id"
@click="openedComment = comment"
@update:file="changeFile"
@close:comment="closeComment"
/>
</template>
<template v-else>
@ -23,13 +25,20 @@
>
<span>Retour à la liste</span>
</button>
<Comment :comment="openedComment" data-opened="true" />
<Comment
:comment="openedComment"
data-opened="true"
@update:file="changeFile"
@close:comment="closeComment"
/>
<div v-if="sortedReplies.length > 0" class="replies | flow">
<Comment
v-for="(reply, commentIndex) in sortedReplies"
:comment="reply"
:commentIndex="sortedReplies.length - commentIndex"
:key="reply.id"
@update:file="changeFile"
@close:comment="closeComment"
/>
</div>
</template>
@ -154,6 +163,15 @@ async function addComment(newComment) {
isAddOpen.value = false;
emits("update:file", newFile);
}
function changeFile(newFile) {
console.log(newFile);
emits("update:file", newFile);
}
function closeComment() {
openedComment.value = null;
}
</script>
<style>
@ -208,4 +226,4 @@ async function addComment(newComment) {
#comments-container form footer > * {
flex-grow: 1;
}
</style>
</style>