add waitingForComment position state

This commit is contained in:
isUnknown 2024-11-19 15:38:39 +01:00
parent b99c05062f
commit 3e57a4bdc9
3 changed files with 7 additions and 2 deletions

View file

@ -65,7 +65,7 @@
</button>
<!-- TODO: afficher #new-comment une fois le bouton Ajouter un commentaire cliqué -->
<div
hidden
v-if="waitingForCommentPosition"
id="new-comment"
class="bg-primary | text-sm text-white | rounded-lg | p-12"
>
@ -131,6 +131,7 @@ const newCommentPosition = ref(null);
const newCommentText = ref("");
const isAddOpen = ref(false);
const route = useRoute();
const waitingForCommentPosition = ref(false);
const sortedComments = computed(() => comments.value.reverse());
const sortedReplies = ref(null);
@ -209,9 +210,11 @@ function closeComment() {
function toggleCommentPositionMode(enable) {
if (enable) {
waitingForCommentPosition.value = true;
viewContainer.classList.add("waiting-comment");
viewContainer.addEventListener("click", handleCommentPositionClick);
} else {
waitingForCommentPosition.value = false;
viewContainer.classList.remove("waiting-comment");
viewContainer.removeEventListener("click", handleCommentPositionClick);
}