From 6447843656446d89d5d8b9aca5a63733444ff461 Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Mon, 5 Aug 2024 16:01:13 +0200 Subject: [PATCH] Add Person count widget (VBV-718) --- client/src/components/dashboard/BaseBox.vue | 16 +++++++---- .../dashboard/BerufsbildnerStatistics.vue | 7 +++++ .../dashboard/MentorMenteeCount.vue | 28 +++++++++++++------ .../assignmentsPage/AssignmentDetails.vue | 5 ++++ 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/client/src/components/dashboard/BaseBox.vue b/client/src/components/dashboard/BaseBox.vue index d0f0310e..eaee5e1d 100644 --- a/client/src/components/dashboard/BaseBox.vue +++ b/client/src/components/dashboard/BaseBox.vue @@ -1,17 +1,23 @@ diff --git a/client/src/components/dashboard/MentorMenteeCount.vue b/client/src/components/dashboard/MentorMenteeCount.vue index d9a76479..71f047f8 100644 --- a/client/src/components/dashboard/MentorMenteeCount.vue +++ b/client/src/components/dashboard/MentorMenteeCount.vue @@ -4,16 +4,27 @@ import { onMounted, ref } from "vue"; import { fetchMenteeCount } from "@/services/dashboard"; import BaseBox from "@/components/dashboard/BaseBox.vue"; -const props = defineProps<{ - courseId: string; - courseSlug: string; -}>(); +const props = withDefaults( + defineProps<{ + courseId: string; + courseSlug: string; + slim?: boolean; + count?: number; + }>(), + { + count: -1, + slim: false, + } +); -const menteeCount: Ref = ref(0); +const menteeCount: Ref = ref(props.count); onMounted(async () => { - const data = await fetchMenteeCount(props.courseId); - menteeCount.value = data?.mentee_count; + if (props.count == -1) { + menteeCount.value = 0; + const data = await fetchMenteeCount(props.courseId); + menteeCount.value = data?.mentee_count; + } }); @@ -22,10 +33,11 @@ onMounted(async () => {