Show "noMenteesText" for Lernbegleiter

This commit is contained in:
Daniel Egger 2024-05-02 12:02:03 +02:00
parent 92d96f4710
commit f11d51b333
1 changed files with 52 additions and 53 deletions

View File

@ -3,6 +3,7 @@ import { useLearningMentees } from "@/services/learningMentees";
import { useCurrentCourseSession } from "@/composables"; import { useCurrentCourseSession } from "@/composables";
import { useCSRFFetch } from "@/fetchHelpers"; import { useCSRFFetch } from "@/fetchHelpers";
import { computed } from "vue"; import { computed } from "vue";
import LoadingSpinner from "@/components/ui/LoadingSpinner.vue";
const courseSession = useCurrentCourseSession(); const courseSession = useCurrentCourseSession();
const { isLoading, summary, fetchData } = useLearningMentees(courseSession.value.id); const { isLoading, summary, fetchData } = useLearningMentees(courseSession.value.id);
@ -22,12 +23,14 @@ const noMenteesText = computed(() =>
</script> </script>
<template> <template>
<div v-if="summary"> <div v-if="isLoading" class="m-8 flex justify-center">
<template v-if="summary.participants.length > 0"> <LoadingSpinner />
</div>
<div v-else>
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2> <h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div class="bg-white px-4 py-2"> <div v-if="(summary?.participants?.length ?? 0) > 0" class="bg-white px-4 py-2">
<div <div
v-for="participant in summary.participants" v-for="participant in summary?.participants ?? []"
:key="participant.id" :key="participant.id"
data-cy="lm-my-mentee-list-item" data-cy="lm-my-mentee-list-item"
class="flex flex-col items-start justify-between gap-4 border-b py-2 last:border-b-0 md:flex-row md:items-center md:gap-16" class="flex flex-col items-start justify-between gap-4 border-b py-2 last:border-b-0 md:flex-row md:items-center md:gap-16"
@ -36,9 +39,7 @@ const noMenteesText = computed(() =>
<img <img
:alt="participant.last_name" :alt="participant.last_name"
class="h-11 w-11 rounded-full" class="h-11 w-11 rounded-full"
:src=" :src="participant.avatar_url || '/static/avatars/myvbv-default-avatar.png'"
participant.avatar_url || '/static/avatars/myvbv-default-avatar.png'
"
/> />
<div> <div>
<div class="text-bold"> <div class="text-bold">
@ -72,13 +73,11 @@ const noMenteesText = computed(() =>
</div> </div>
</div> </div>
</div> </div>
</template> <div v-else>
</div>
<div v-if="!isLoading && !summary">
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div class="flex items-center bg-white px-4 py-2"> <div class="flex items-center bg-white px-4 py-2">
<it-icon-info class="it-icon mr-2 h-6 w-6" /> <it-icon-info class="it-icon mr-2 h-6 w-6" />
{{ $t(noMenteesText) }} {{ $t(noMenteesText) }}
</div> </div>
</div> </div>
</div>
</template> </template>