VBV-232: WIP - Style feedback content type

This commit is contained in:
Christian Cueni 2023-01-13 16:53:14 +01:00
parent 46368ee374
commit c36df95e02
10 changed files with 85 additions and 33 deletions

View File

@ -1,88 +1,93 @@
<template> <template>
<div> <div>
<p class="text-gray-800 mb-4">Schritt {{ stepNo + 1 }} von {{ MAX_STEPS }}</p> <FeedbackIntro
<p class="mb-10 text-xl" v-html="$t('feedback.intro')"></p>
<ItRadioGroup
v-if="stepNo === 0" v-if="stepNo === 0"
:title="circleStore.circle?.title"
:intro="$t('feedback.intro', {name: `${courseSessionsStore.circleExperts[0].first_name} ${courseSessionsStore.circleExperts[0].last_name}`})"
@start="stepNo = 1"
></FeedbackIntro>
<ItRadioGroup
v-if="stepNo === 1"
v-model="wouldRecommend" v-model="wouldRecommend"
:label="$t('feedback.recommendLabel')" :label="$t('feedback.recommendLabel')"
class="mb-8" class="mb-8"
:items="YES_NO" :items="YES_NO"
/> />
<ItRadioGroup <ItRadioGroup
v-if="stepNo === 1" v-if="stepNo === 2"
v-model="satisfaction" v-model="satisfaction"
:label="$t('feedback.satisfactionLabel')" :label="$t('feedback.satisfactionLabel')"
class="mb-8" class="mb-8"
:items="RATINGS" :items="RATINGS"
/> />
<ItRadioGroup <ItRadioGroup
v-if="stepNo === 2" v-if="stepNo === 3"
v-model="goalAttainment" v-model="goalAttainment"
:label="$t('feedback.goalAttainmentLabel')" :label="$t('feedback.goalAttainmentLabel')"
class="mb-8" class="mb-8"
:items="RATINGS" :items="RATINGS"
/> />
<ItRadioGroup <ItRadioGroup
v-if="stepNo === 3" v-if="stepNo === 4"
v-model="proficiency" v-model="proficiency"
:label="$t('feedback.proficiencyLabel')" :label="$t('feedback.proficiencyLabel')"
class="mb-8" class="mb-8"
:items="PERCENTAGES" :items="PERCENTAGES"
/> />
<ItRadioGroup <ItRadioGroup
v-if="stepNo === 4" v-if="stepNo === 5"
v-model="receivedMaterials" v-model="receivedMaterials"
:label="$t('feedback.receivedMaterialsLabel')" :label="$t('feedback.receivedMaterialsLabel')"
class="mb-8" class="mb-8"
:items="YES_NO" :items="YES_NO"
/> />
<ItRadioGroup <ItRadioGroup
v-if="stepNo === 4 && receivedMaterials" v-if="stepNo === 5 && receivedMaterials"
v-model="materialsRating" v-model="materialsRating"
:label="$t('feedback.materialsRatingLabel')" :label="$t('feedback.materialsRatingLabel')"
class="mb-8" class="mb-8"
:items="RATINGS" :items="RATINGS"
/> />
<ItRadioGroup <ItRadioGroup
v-if="stepNo === 5" v-if="stepNo === 6"
v-model="instructorCompetence" v-model="instructorCompetence"
:label="$t('feedback.instructorCompetenceLabel')" :label="$t('feedback.instructorCompetenceLabel')"
class="mb-8" class="mb-8"
:items="RATINGS" :items="RATINGS"
/> />
<ItRadioGroup <ItRadioGroup
v-if="stepNo === 6" v-if="stepNo === 7"
v-model="instructorRespect" v-model="instructorRespect"
class="mb-8" class="mb-8"
:label="$t('feedback.instructorRespectLabel')" :label="$t('feedback.instructorRespectLabel')"
:items="RATINGS" :items="RATINGS"
/> />
<ItTextarea <ItTextarea
v-if="stepNo === 7" v-if="stepNo === 8"
v-model="instructorOpenFeedback" v-model="instructorOpenFeedback"
:label="$t('feedback.instructorOpenFeedbackLabel')" :label="$t('feedback.instructorOpenFeedbackLabel')"
class="mb-8" class="mb-8"
/> />
<ItTextarea <ItTextarea
v-if="stepNo === 8" v-if="stepNo === 9"
v-model="courseNegativeFeedback" v-model="courseNegativeFeedback"
:label="$t('feedback.courseNegativeFeedbackLabel')" :label="$t('feedback.courseNegativeFeedbackLabel')"
class="mb-8" class="mb-8"
/> />
<ItTextarea <ItTextarea
v-if="stepNo === 9" v-if="stepNo === 8"
v-model="coursePositiveFeedback" v-model="coursePositiveFeedback"
:label="$t('feedback.coursePositiveFeedbackLabel')" :label="$t('feedback.coursePositiveFeedbackLabel')"
class="mb-8" class="mb-8"
/> />
<button class="btn-blue" @click="sendFeedback">Senden und abschliessen</button> <LearningContentNavigation
<button class="btn-blue mr-4" :disabled="stepNo <= 0" @click="previousStep"> :show-back-button="stepNo > 0"
Zurück :show-next-button="stepNo > 0"
</button> :question-index="stepNo"
<button class="btn-blue" :disabled="stepNo >= MAX_STEPS - 1" @click="nextStep"> :max-question-index="MAX_STEPS"
Weiter @back="previousStep"
</button> @continue="nextStep"
></LearningContentNavigation>
<hr class="mb-10 mt-10" /> <hr class="mb-10 mt-10" />
<pre> <pre>
satisfaction {{ satisfaction }} satisfaction {{ satisfaction }}
@ -109,9 +114,12 @@ import {
} from "@/components/learningPath/feedback.constants"; } from "@/components/learningPath/feedback.constants";
import ItRadioGroup from "@/components/ui/ItRadioGroup.vue"; import ItRadioGroup from "@/components/ui/ItRadioGroup.vue";
import ItTextarea from "@/components/ui/ItTextarea.vue"; import ItTextarea from "@/components/ui/ItTextarea.vue";
import FeedbackIntro from "@/components/learningPath/FeedbackIntro.vue";
import LearningContentNavigation from "@/components/learningPath/LearningContentNavigation.vue";
import { graphql } from "@/gql/"; import { graphql } from "@/gql/";
import type { SendFeedbackInput } from "@/gql/graphql"; import type { SendFeedbackInput } from "@/gql/graphql";
import { useCourseSessionsStore } from "@/stores/courseSessions"; import { useCourseSessionsStore } from "@/stores/courseSessions";
import { useCircleStore } from "@/stores/circle";
import type { LearningContent } from "@/types"; import type { LearningContent } from "@/types";
import { useMutation } from "@urql/vue"; import { useMutation } from "@urql/vue";
import log from "loglevel"; import log from "loglevel";
@ -119,6 +127,7 @@ import { onMounted, reactive, ref } from "vue";
const props = defineProps<{ page: LearningContent }>(); const props = defineProps<{ page: LearningContent }>();
const courseSessionsStore = useCourseSessionsStore(); const courseSessionsStore = useCourseSessionsStore();
const circleStore = useCircleStore();
onMounted(async () => { onMounted(async () => {
log.debug("Feedback mounted"); log.debug("Feedback mounted");

View File

@ -0,0 +1,23 @@
<template>
<div>
<h1 class="mb-8">«{{ title }}»: {{ $t("feedback.areYouSatisfied") }}</h1>
<p class="mb-8"> {{ intro }}</p>
<button
class="btn-primary"
@click="$emit('start')">{{ $t("general.start") }}</button>
</div>
</template>
<script setup lang="ts">
interface Props {
title: string;
intro: string;
};
const _props = withDefaults(defineProps<Props>(), {
title: "",
intro: "",
});
defineEmits(["start"]);
</script>

View File

@ -48,6 +48,11 @@ const component = computed(() => {
} }
return DEFAULT_BLOCK; return DEFAULT_BLOCK;
}); });
const showNavigationBorder = computed(() => {
return block.value?.type !== "feedback";
});
</script> </script>
<template> <template>
@ -56,6 +61,7 @@ const component = computed(() => {
:title="learningContent.title" :title="learningContent.title"
:next-button-text="$t('learningContent.completeAndContinue')" :next-button-text="$t('learningContent.completeAndContinue')"
:learning-content-block="learningContent.contents[0]" :learning-content-block="learningContent.contents[0]"
:show-border="showNavigationBorder"
@exit="circleStore.closeLearningContent(props.learningContent)" @exit="circleStore.closeLearningContent(props.learningContent)"
@next="circleStore.continueFromLearningContent(props.learningContent)" @next="circleStore.continueFromLearningContent(props.learningContent)"
> >

View File

@ -12,7 +12,7 @@ interface Props {
showBorder: boolean; showBorder: boolean;
} }
const props = withDefaults(defineProps<Props>(), { const _props = withDefaults(defineProps<Props>(), {
title: "", title: "",
nextButtonText: "", nextButtonText: "",
learningContentBlock: null, learningContentBlock: null,
@ -47,11 +47,11 @@ defineEmits(["next", "exit"]);
:class="{ 'border-t': showBorder }" :class="{ 'border-t': showBorder }"
> >
<div class="flex justify-between"> <div class="flex justify-between">
<LearningContentBadge <!-- <LearningContentBadge
v-if="learningContentBlock" v-if="learningContentBlock && learningContentBlock.type"
:learning-content-type="learningContentBlock.type" :learning-content-type="learningContentBlock.type"
class="mr-2" class="mr-2"
/> /> -->
<h1 class="text-base font-normal hidden lg:inline-block" data-cy="ln-title"> <h1 class="text-base font-normal hidden lg:inline-block" data-cy="ln-title">
{{ title }} {{ title }}
</h1> </h1>

View File

@ -1,9 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{ interface Props {
showBackButton: boolean; showBackButton: boolean;
showNextButton: boolean;
questionIndex: number; questionIndex: number;
maxQuestionIndex: number; maxQuestionIndex: number;
}>(); };
const _props = withDefaults(defineProps<Props>(), {
showBackButton: true,
showNextButton: true,
questionIndex: 0,
maxQuestionIndex: 0,
});
defineEmits(["back", "continue"]); defineEmits(["back", "continue"]);
</script> </script>
@ -21,6 +30,7 @@ defineEmits(["back", "continue"]);
{{ $t("general.backCapitalized") }} {{ $t("general.backCapitalized") }}
</button> </button>
<button <button
v-if="showNextButton"
class="btn-secondary flex items-center" class="btn-secondary flex items-center"
@click="$emit('continue')" @click="$emit('continue')"
data-cy="next-step"> data-cy="next-step">

View File

@ -1,7 +1,6 @@
<template> <template>
<div <div
:model-value="modelValue" :model-value="modelValue"
class="border p-12"
@update:modelValue="$emit('update:modelValue', $event)" @update:modelValue="$emit('update:modelValue', $event)"
> >
<h2 class="text-5xl mb-12 leading-normal font-bold block">{{ label }}</h2> <h2 class="text-5xl mb-12 leading-normal font-bold block">{{ label }}</h2>

View File

@ -1,13 +1,12 @@
<template> <template>
<RadioGroup <RadioGroup
:model-value="modelValue" :model-value="modelValue"
class="border p-12"
@update:modelValue="$emit('update:modelValue', $event)" @update:modelValue="$emit('update:modelValue', $event)"
> >
<RadioGroupLabel class="text-5xl mb-12 leading-normal font-bold block"> <RadioGroupLabel class="heading-1 mb-8 block">
{{ label }} {{ label }}
</RadioGroupLabel> </RadioGroupLabel>
<div class="flex justify-between align-items-center justify-items-center space-x-6"> <div class="flex flex-col md:flex-row justify-between align-items-center justify-items-center space-y-6 md:space-y-0 md:space-x-6">
<RadioGroupOption <RadioGroupOption
v-for="item in items" v-for="item in items"
:key="item.value" :key="item.value"

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="border p-12"> <div>
<h2 class="text-5xl mb-12 leading-normal font-bold block">{{ label }}</h2> <h2 class="text-5xl mb-12 leading-normal font-bold block">{{ label }}</h2>
<textarea <textarea
:value="modelValue" :value="modelValue"

View File

@ -115,7 +115,8 @@
"sendMessage": "Nachricht schreiben" "sendMessage": "Nachricht schreiben"
}, },
"feedback": { "feedback": {
"intro": "Dein/e Trainer/in bittet dich, ihr/ihm Feedback zu geben. <br /> Das ist freiwillig, würde ihr aber helfen, dein Lernerlebnis zu verbessern.", "intro": "{name}, dein/e Trainer/-in, bittet dich, ihm/ihr Feedback zu geben. Das ist freiwillig, würde aber ihm/ihr helfen, deine Lernerlebniss zu verbessern.",
"areYouSatisfied": "Wie zufrieden bist du?",
"recommendLabel": "Würden Sie den Kurs weiterempfehlen?", "recommendLabel": "Würden Sie den Kurs weiterempfehlen?",
"satisfactionLabel": "Zufriedenheit insgesamt", "satisfactionLabel": "Zufriedenheit insgesamt",
"goalAttainmentLabel": "Zielerreichung insgesamt", "goalAttainmentLabel": "Zielerreichung insgesamt",

View File

@ -74,6 +74,10 @@ export interface PlaceholderBlock extends BaseLearningContentBlock {
readonly type: "placeholder"; readonly type: "placeholder";
} }
export interface FeedbackBlock extends BaseLearningContentBlock {
readonly type: "feedback";
}
export type LearningContentBlock = export type LearningContentBlock =
| AssignmentBlock | AssignmentBlock
| BookBlock | BookBlock
@ -85,7 +89,8 @@ export type LearningContentBlock =
| TestBlock | TestBlock
| VideoBlock | VideoBlock
| LearningModuleBlock | LearningModuleBlock
| PlaceholderBlock; | PlaceholderBlock
| FeedbackBlock;
export type LearningContentType = LearningContentBlock["type"]; export type LearningContentType = LearningContentBlock["type"];