fix: participant-less mentor edge case



This commit is contained in:
Livio Bieri 2024-03-18 15:21:11 +01:00
parent 72bc985bf1
commit e33bf185c1
2 changed files with 40 additions and 37 deletions

View File

@ -8,36 +8,47 @@ const { summary } = useLearningMentees(courseSession.value.id);
<template>
<div v-if="summary">
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div class="bg-white px-4 py-2">
<div
v-for="participant in summary.participants"
:key="participant.id"
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"
>
<div class="flex items-center space-x-2">
<img
:alt="participant.last_name"
class="h-11 w-11 rounded-full"
:src="participant.avatar_url || '/static/avatars/myvbv-default-avatar.png'"
/>
<div>
<div class="text-bold">
{{ participant.first_name }}
{{ participant.last_name }}
</div>
{{ participant.email }}
</div>
</div>
<router-link
:to="{
name: 'profileLearningPath',
params: { userId: participant.id, courseSlug: courseSession.course.slug },
}"
class="underline"
<template v-if="summary.participants.length > 0">
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div class="bg-white px-4 py-2">
<div
v-for="participant in summary.participants"
:key="participant.id"
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"
>
{{ $t("cockpit.profileLink") }}
</router-link>
<div class="flex items-center space-x-2">
<img
:alt="participant.last_name"
class="h-11 w-11 rounded-full"
:src="
participant.avatar_url || '/static/avatars/myvbv-default-avatar.png'
"
/>
<div>
<div class="text-bold">
{{ participant.first_name }}
{{ participant.last_name }}
</div>
{{ participant.email }}
</div>
</div>
<router-link
:to="{
name: 'profileLearningPath',
params: { userId: participant.id, courseSlug: courseSession.course.slug },
}"
class="underline"
>
{{ $t("cockpit.profileLink") }}
</router-link>
</div>
</div>
</template>
<div v-else>
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div class="flex items-center bg-white px-4 py-2">
<it-icon-info class="it-icon mr-2 h-6 w-6" />
{{ $t("a.Aktuell begleitest du niemanden als Lernbegleitung.") }}
</div>
</div>
</div>

View File

@ -25,13 +25,5 @@ const isMyMenteesVisible = computed(() =>
<MyMentees />
</div>
</template>
<!-- edge case for pure mentor (= no course session user) and all mentees are removed -->
<div v-else>
<h2 class="heading-2 py-6">{{ $t("a.Personen, die du begleitest") }}</h2>
<div class="flex items-center bg-white px-4 py-2">
<it-icon-info class="it-icon mr-2 h-6 w-6" />
{{ $t("a.Aktuell begleitest du niemanden als Lernbegleitung.") }}
</div>
</div>
</div>
</template>