comments : fix replies visibility

This commit is contained in:
isUnknown 2024-11-08 12:25:00 +01:00
parent 6e0b2299e2
commit d3e73bc8de
3 changed files with 29 additions and 18 deletions

View file

@ -123,16 +123,16 @@ Comments:
uuid: file://s0lNtRA0Z7ybTCWG uuid: file://s0lNtRA0Z7ybTCWG
pageIndex: 1 pageIndex: 1
replies: [ ] replies: [ ]
text: commentaire positionné text: ouveau commentaire
author: author:
name: Adrien Payet name: Utilisateur Dior
email: adrien.payet@outlook.com email: utilisateur@dior.com
uuid: user://WWjXgPWk uuid: user://HfuumN8s
role: admin role: client
date: 2024-11-06T16:35:30+01:00 date: 2024-11-06T16:57:15+01:00
id: m361j842 id: m362b71x
type: comment type: comment
isRead: false isRead: false
position: position:
x: '239.03332519531' x: '59.033325195312'
y: 74 y: 59

View file

@ -63,12 +63,17 @@
</button> </button>
<!-- TODO: afficher #new-comment une fois le bouton Ajouter un commentaire cliqué --> <!-- TODO: afficher #new-comment une fois le bouton Ajouter un commentaire cliqué -->
<div <div
hidden hidden
id="new-comment" id="new-comment"
class="bg-primary | text-sm text-white | rounded-lg | p-12" class="bg-primary | text-sm text-white | rounded-lg | p-12"
> >
<p class="flex justify-start | mb-12" data-icon="comment"><strong>Nouveau commentaire</strong></p> <p class="flex justify-start | mb-12" data-icon="comment">
<p>Dans la zone du contenu, cliquez vous souhaitez positionner le commentaire</p> <strong>Nouveau commentaire</strong>
</p>
<p>
Dans la zone du contenu, cliquez vous souhaitez positionner le
commentaire
</p>
</div> </div>
<form <form
v-if="isAddOpen" v-if="isAddOpen"
@ -125,11 +130,13 @@ const newCommentPosition = ref(null);
const newCommentText = ref(""); const newCommentText = ref("");
const isAddOpen = ref(false); const isAddOpen = ref(false);
const emits = defineEmits(["update:file"]); const emits = defineEmits(["update:file"]);
const sortedComments = ref(comments.reverse()); const sortedComments = ref(comments.reverse());
const sortedReplies = const sortedReplies = ref(null);
openedComment.value && openedComment.value.replies
? ref(openedComment.value.replies.slice().reverse()) watch(openedComment, (newVal) => {
: ref([]); sortedReplies.value = newVal ? newVal.replies.slice().reverse() : null;
});
watch( watch(
() => comments, () => comments,
@ -254,7 +261,7 @@ function handleCommentPositionClick(event) {
padding-right: 2rem; padding-right: 2rem;
} }
.comments.empty::after { .comments.empty::after {
content: 'Partagez vos idées en ajoutant des commentaires'; content: "Partagez vos idées en ajoutant des commentaires";
height: 100%; height: 100%;
display: grid; display: grid;
place-items: center; place-items: center;

View file

@ -41,7 +41,11 @@
data-icon="document" data-icon="document"
></div> ></div>
</template> </template>
<footer>2 commentaire(s)</footer> <footer v-if="step?.files[0]?.comments?.length > 0">
{{ step.files[0].comments.length }} commentaire{{
step.files[0].comments.length > 1 ? "s" : ""
}}
</footer>
</article> </article>
</div> </div>
</router-link> </router-link>