Provide LearningContent to badge logic
This commit is contained in:
parent
9be0ce9d39
commit
de320be3cb
|
|
@ -131,8 +131,8 @@ const sendFeedback = () => {
|
||||||
<template>
|
<template>
|
||||||
<LearningContentMultiLayout
|
<LearningContentMultiLayout
|
||||||
:title="title"
|
:title="title"
|
||||||
subtitle="Feedback"
|
sub-title="Feedback"
|
||||||
learning-content-type="learnpath.LearningContentFeedback"
|
:learning-content="page"
|
||||||
:show-start-button="stepNo === 0"
|
:show-start-button="stepNo === 0"
|
||||||
:show-next-button="stepNo > 0 && stepNo + 1 < numSteps"
|
:show-next-button="stepNo > 0 && stepNo + 1 < numSteps"
|
||||||
:show-previous-button="stepNo > 0"
|
:show-previous-button="stepNo > 0"
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { LearningContentType } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
import { learningContentTypeData } from "@/utils/typeMaps";
|
import { learningContentTypeData } from "@/utils/typeMaps";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
learningContentType: LearningContentType;
|
learningContent: LearningContent;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="props.learningContentType !== 'learnpath.LearningContentPlaceholder'"
|
v-if="props.learningContent.content_type !== 'learnpath.LearningContentPlaceholder'"
|
||||||
class="flex h-min w-min items-center gap-2 rounded-full bg-gray-200 px-2.5 py-0.5"
|
class="flex h-min w-min items-center gap-2 rounded-full bg-gray-200 px-2.5 py-0.5"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:is="learningContentTypeData(props.learningContentType).icon"
|
:is="learningContentTypeData(props.learningContent).icon"
|
||||||
class="h-6 w-6"
|
class="h-6 w-6"
|
||||||
></component>
|
></component>
|
||||||
<p class="whitespace-nowrap">
|
<p class="whitespace-nowrap">
|
||||||
{{ learningContentTypeData(props.learningContentType).title }}
|
{{ learningContentTypeData(props.learningContent).title }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -172,9 +172,7 @@ const learningSequenceBorderClass = computed(() => {
|
||||||
</button>
|
</button>
|
||||||
<div class="hidden sm:block"></div>
|
<div class="hidden sm:block"></div>
|
||||||
<div class="w-full sm:w-auto">
|
<div class="w-full sm:w-auto">
|
||||||
<LearningContentBadge
|
<LearningContentBadge :learning-content="learningContent" />
|
||||||
:learning-content-type="learningContent.content_type"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
|
|
@ -197,9 +197,9 @@ const endBadgeText = computed(() => {
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<LearningContentMultiLayout
|
<LearningContentMultiLayout
|
||||||
:current-step="stepIndex"
|
:current-step="stepIndex"
|
||||||
:subtitle="subTitle"
|
:sub-title="subTitle"
|
||||||
:title="getTitle()"
|
:title="getTitle()"
|
||||||
:learning-content-type="props.learningContent.content_type"
|
:learning-content="props.learningContent"
|
||||||
:steps-count="numPages"
|
:steps-count="numPages"
|
||||||
:show-next-button="showNextButton && stepIndex !== 0"
|
:show-next-button="showNextButton && stepIndex !== 0"
|
||||||
:show-exit-button="showExitButton"
|
:show-exit-button="showExitButton"
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,7 @@ const courseSessionAttendanceCourse = computed(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout :title="content.title" :learning-content="props.content">
|
||||||
:title="content.title"
|
|
||||||
:learning-content-type="props.content.content_type"
|
|
||||||
>
|
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
<div class="lg:mt-8">
|
<div class="lg:mt-8">
|
||||||
<div class="text-large my-4">
|
<div class="text-large my-4">
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
||||||
import type { LearningContentInterface } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
content: LearningContentInterface;
|
content: LearningContent;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout :learning-content-type="props.content.content_type">
|
<LearningContentSimpleLayout :learning-content="props.content">
|
||||||
<div class="h-screen">
|
<div class="h-screen">
|
||||||
<iframe
|
<iframe
|
||||||
width="100%"
|
width="100%"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ log.debug("LearningContentMediaLibraryBlock.vue created");
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout
|
||||||
:title="props.content.title"
|
:title="props.content.title"
|
||||||
:learning-content-type="props.content.content_type"
|
:learning-content="props.content"
|
||||||
>
|
>
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
<!-- eslint-disable vue/no-v-html -->
|
<!-- eslint-disable vue/no-v-html -->
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
import LearningContentSimpleLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentSimpleLayout.vue";
|
||||||
import type { LearningContentInterface } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
content: LearningContentInterface;
|
content: LearningContent;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout
|
||||||
:title="props.content.title"
|
:title="props.content.title"
|
||||||
:learning-content-type="props.content.content_type"
|
:learning-content="props.content"
|
||||||
>
|
>
|
||||||
<!-- eslint-disable vue/no-v-html -->
|
<!-- eslint-disable vue/no-v-html -->
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const props = defineProps<{
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout
|
||||||
:title="props.content.title"
|
:title="props.content.title"
|
||||||
:learning-content-type="props.content.content_type"
|
:learning-content="props.content"
|
||||||
>
|
>
|
||||||
<!-- eslint-disable vue/no-v-html -->
|
<!-- eslint-disable vue/no-v-html -->
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<LearningContentSimpleLayout
|
<LearningContentSimpleLayout
|
||||||
:title="props.content.title"
|
:title="props.content.title"
|
||||||
:learning-content-type="props.content.content_type"
|
:learning-content="props.content"
|
||||||
>
|
>
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
<iframe
|
<iframe
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,15 @@
|
||||||
import ItNavigationProgress from "@/components/ui/ItNavigationProgress.vue";
|
import ItNavigationProgress from "@/components/ui/ItNavigationProgress.vue";
|
||||||
import type { ClosingButtonVariant } from "@/pages/learningPath/learningContentPage/layouts/LearningContentFooter.vue";
|
import type { ClosingButtonVariant } from "@/pages/learningPath/learningContentPage/layouts/LearningContentFooter.vue";
|
||||||
import LearningContentFooter from "@/pages/learningPath/learningContentPage/layouts/LearningContentFooter.vue";
|
import LearningContentFooter from "@/pages/learningPath/learningContentPage/layouts/LearningContentFooter.vue";
|
||||||
import type { LearningContentType } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
import { learningContentTypeData } from "@/utils/typeMaps";
|
import { learningContentTypeData } from "@/utils/typeMaps";
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title?: string;
|
title?: string;
|
||||||
subtitle: string;
|
subTitle?: string;
|
||||||
learningContentType: LearningContentType;
|
icon?: string;
|
||||||
|
learningContent?: LearningContent;
|
||||||
showStartButton: boolean;
|
showStartButton: boolean;
|
||||||
showPreviousButton: boolean;
|
showPreviousButton: boolean;
|
||||||
showNextButton: boolean;
|
showNextButton: boolean;
|
||||||
|
|
@ -24,7 +26,10 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
title: undefined,
|
title: "",
|
||||||
|
subTitle: "",
|
||||||
|
icon: "",
|
||||||
|
learningContent: undefined,
|
||||||
startBadgeText: undefined,
|
startBadgeText: undefined,
|
||||||
endBadgeText: undefined,
|
endBadgeText: undefined,
|
||||||
closeButtonVariant: "mark_as_done",
|
closeButtonVariant: "mark_as_done",
|
||||||
|
|
@ -32,21 +37,40 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
stepQueryParam: undefined,
|
stepQueryParam: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const subTitle = computed(() => {
|
||||||
|
if (props.subTitle) {
|
||||||
|
return props.subTitle;
|
||||||
|
}
|
||||||
|
if (props.learningContent) {
|
||||||
|
return learningContentTypeData(props.learningContent).title;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
|
||||||
|
const icon = computed(() => {
|
||||||
|
if (props.icon) {
|
||||||
|
return props.icon;
|
||||||
|
}
|
||||||
|
if (props.learningContent) {
|
||||||
|
return learningContentTypeData(props.learningContent).icon;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["previous", "next", "exit"]);
|
const emit = defineEmits(["previous", "next", "exit"]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container-large">
|
<div class="container-large">
|
||||||
<div
|
<div
|
||||||
v-if="props.learningContentType !== 'learnpath.LearningContentPlaceholder'"
|
v-if="
|
||||||
|
props.learningContent?.content_type !== 'learnpath.LearningContentPlaceholder'
|
||||||
|
"
|
||||||
class="flex h-min items-center gap-2 rounded-full pb-10"
|
class="flex h-min items-center gap-2 rounded-full pb-10"
|
||||||
>
|
>
|
||||||
<component
|
<component :is="icon" v-if="icon" class="h-6 w-6 text-gray-900"></component>
|
||||||
:is="learningContentTypeData(props.learningContentType).icon"
|
<p v-if="subTitle" class="text-gray-900" data-cy="lc-subtitle">
|
||||||
class="h-6 w-6 text-gray-900"
|
{{ subTitle }}
|
||||||
></component>
|
|
||||||
<p class="text-gray-900" data-cy="lc-subtitle">
|
|
||||||
{{ props.subtitle }}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,56 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// Basic layout for a learning content that only has a single step
|
// Basic layout for a learning content that only has a single step
|
||||||
import LearningContentFooter from "@/pages/learningPath/learningContentPage/layouts/LearningContentFooter.vue";
|
import LearningContentFooter from "@/pages/learningPath/learningContentPage/layouts/LearningContentFooter.vue";
|
||||||
import type { LearningContentType } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
import { learningContentTypeData } from "@/utils/typeMaps";
|
import { learningContentTypeData } from "@/utils/typeMaps";
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
title?: string;
|
title?: string;
|
||||||
learningContentType: LearningContentType;
|
icon?: string;
|
||||||
|
subTitle?: string;
|
||||||
|
learningContent?: LearningContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
title: "",
|
title: "",
|
||||||
|
icon: "",
|
||||||
|
subTitle: "",
|
||||||
|
learningContent: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const type = learningContentTypeData(props.learningContentType);
|
const subTitle = computed(() => {
|
||||||
|
if (props.subTitle) {
|
||||||
|
return props.subTitle;
|
||||||
|
}
|
||||||
|
if (props.learningContent) {
|
||||||
|
return learningContentTypeData(props.learningContent).title;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
|
||||||
|
const icon = computed(() => {
|
||||||
|
if (props.icon) {
|
||||||
|
return props.icon;
|
||||||
|
}
|
||||||
|
if (props.learningContent) {
|
||||||
|
return learningContentTypeData(props.learningContent).icon;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container-medium">
|
<div class="container-medium">
|
||||||
<div
|
<div
|
||||||
v-if="props.learningContentType !== 'learnpath.LearningContentPlaceholder'"
|
v-if="
|
||||||
|
props.learningContent?.content_type !== 'learnpath.LearningContentPlaceholder'
|
||||||
|
"
|
||||||
class="flex h-min w-full items-center gap-2 pb-8"
|
class="flex h-min w-full items-center gap-2 pb-8"
|
||||||
>
|
>
|
||||||
<component :is="type.icon" class="h-6 w-6 text-gray-900"></component>
|
<component :is="icon" v-if="icon" class="h-6 w-6 text-gray-900"></component>
|
||||||
<p class="whitespace-nowrap text-gray-900" data-cy="lc-subtitle">
|
<p v-if="subTitle" class="whitespace-nowrap text-gray-900" data-cy="lc-subtitle">
|
||||||
{{ type.title }}
|
{{ subTitle }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,9 @@ onUnmounted(() => {
|
||||||
>
|
>
|
||||||
<LearningContentMultiLayout
|
<LearningContentMultiLayout
|
||||||
:current-step="questionIndex"
|
:current-step="questionIndex"
|
||||||
:subtitle="$t('selfEvaluation.title')"
|
:sub-title="$t('selfEvaluation.title')"
|
||||||
:title="$t('selfEvaluation.title', { title: learningUnit.title })"
|
:title="$t('selfEvaluation.title', { title: learningUnit.title })"
|
||||||
learning-content-type="learnpath.LearningContentLearningModule"
|
icon="it-icon-lc-learning-module"
|
||||||
:steps-count="questions.length"
|
:steps-count="questions.length"
|
||||||
:show-next-button="showNextButton"
|
:show-next-button="showNextButton"
|
||||||
:show-exit-button="showExitButton"
|
:show-exit-button="showExitButton"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { LearningContentType } from "@/types";
|
import type { LearningContent } from "@/types";
|
||||||
import { assertUnreachable } from "@/utils/utils";
|
import { assertUnreachable } from "@/utils/utils";
|
||||||
|
|
||||||
export interface LearningContentIdentifier {
|
export interface LearningContentIdentifier {
|
||||||
|
|
@ -7,9 +7,9 @@ export interface LearningContentIdentifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function learningContentTypeData(
|
export function learningContentTypeData(
|
||||||
t: LearningContentType
|
lc: LearningContent
|
||||||
): LearningContentIdentifier {
|
): LearningContentIdentifier {
|
||||||
switch (t) {
|
switch (lc.content_type) {
|
||||||
case "learnpath.LearningContentAssignment":
|
case "learnpath.LearningContentAssignment":
|
||||||
return { title: "Geleitete Fallarbeit", icon: "it-icon-lc-assignment" };
|
return { title: "Geleitete Fallarbeit", icon: "it-icon-lc-assignment" };
|
||||||
case "learnpath.LearningContentAttendanceCourse":
|
case "learnpath.LearningContentAttendanceCourse":
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue