Bruno Predot

Ajout section supplémentaire si aucun commentaire existant dans le store.

1 <script setup lang="ts"> 1 <script setup lang="ts">
2 //#region --Import--. 2 //#region --Import--.
3 import type { MovieCommentInterface } from "~/interfaces/movieComment"; 3 import type { MovieCommentInterface } from "~/interfaces/movieComment";
  4 +import { MessageSquareIcon } from "lucide-vue-next";
4 //#endregion 5 //#endregion
5 6
6 //#region --Props--. 7 //#region --Props--.
@@ -15,25 +16,32 @@ defineProps({ @@ -15,25 +16,32 @@ defineProps({
15 </script> 16 </script>
16 17
17 <template> 18 <template>
18 - <!-- Liste des commentaires --> 19 + <section>
19 - <section v-if="comments.length > 0" class="mt-10"> 20 + <!-- Liste des commentaires -->
20 - <h2>Commentaires publiés</h2> 21 + <section v-if="comments.length > 0" class="mt-10">
21 - <div 22 + <h2>Commentaires publiés</h2>
22 - v-for="(comment, index) in comments" 23 + <div
23 - :key="index" 24 + v-for="(comment, index) in comments"
24 - class="bg-gray-800 rounded-lg p-6 mb-4" 25 + :key="index"
25 - > 26 + class="bg-gray-800 rounded-lg p-6 mb-4"
26 - <div class="flex justify-between items-start mb-2"> 27 + >
27 - <div> 28 + <div class="flex justify-between items-start mb-2">
28 - <h4 class="font-bold text-lg">Par {{ comment.username }}</h4> 29 + <section>
29 - <p class="text-sm text-gray-400">Le {{ useDateFormat(comment.createdAt, "DD-MM-YYYY") }}</p> 30 + <h4 class="font-bold text-lg">Par {{ comment.username }}</h4>
30 - </div> 31 + <p class="text-sm text-gray-400">Le {{ useDateFormat(comment.createdAt, "DD-MM-YYYY") }}</p>
31 - <div class="bg-primary text-white rounded-full w-10 h-10 flex items-center justify-center font-bold"> 32 + </section>
32 - {{ comment.rating }} 33 + <section class="bg-primary text-white rounded-full w-10 h-10 flex items-center justify-center font-bold">
  34 + {{ comment.rating }}
  35 + </section>
33 </div> 36 </div>
  37 + <p class="text-gray-300">{{ comment.message }}</p>
34 </div> 38 </div>
35 - <p class="text-gray-300">{{ comment.message }}</p> 39 + </section>
36 - </div> 40 + <!-- Si aucun commentaire -->
  41 + <section v-else class="text-center py-8 bg-gray-800 rounded-lg mt-10">
  42 + <MessageSquareIcon :size="48" class="mx-auto mb-3 text-gray-600" />
  43 + <p class="text-gray-400">Aucun commentaire pour le moment. Soyez le premier à donner votre avis !</p>
  44 + </section>
37 </section> 45 </section>
38 </template> 46 </template>
39 47