Merge pull request #286 from SELab-2/extra/discussions

extra: Discussions optimalisaties
This commit is contained in:
Timo De Meyst 2025-05-20 20:25:29 +02:00 committed by GitHub
commit 8905182f78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 34 deletions

View file

@ -4,6 +4,7 @@
import { useLearningObjectListForPathQuery } from "@/queries/learning-objects"; import { useLearningObjectListForPathQuery } from "@/queries/learning-objects";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import UsingQueryResult from "@/components/UsingQueryResult.vue"; import UsingQueryResult from "@/components/UsingQueryResult.vue";
import QuestionNotification from "@/components/QuestionNotification.vue";
const route = useRoute(); const route = useRoute();
@ -11,38 +12,34 @@
path: LearningPath; path: LearningPath;
activeObjectId: string; activeObjectId: string;
}>(); }>();
const learningObjects = useLearningObjectListForPathQuery(props.path);
</script> </script>
<template> <template>
<v-expansion-panel :value="props.path.hruid"> <using-query-result
<v-expansion-panel-title> :query-result="learningObjects"
{{ path.title }} v-slot="learningObjects: { data: LearningObject[] }"
</v-expansion-panel-title> >
<v-expansion-panel-text> <template
<v-lazy> v-for="node in learningObjects.data"
<using-query-result :key="node.key"
:query-result="useLearningObjectListForPathQuery(props.path)" >
v-slot="learningObjects: { data: LearningObject[] }" <v-list-item
> link
<template :to="{
v-for="node in learningObjects.data" path: `/discussion-reload/${props.path.hruid}/${node.language}/${node.key}`,
:key="node.key" query: route.query,
> }"
<v-list-item :title="node.title"
link :active="node.key === props.activeObjectId"
:to="{ >
path: `/discussion-reload/${props.path.hruid}/${node.language}/${node.key}`, <template v-slot:append>
query: route.query, <QuestionNotification :node="node"></QuestionNotification>
}" </template>
:title="node.title" </v-list-item>
:active="node.key === props.activeObjectId" </template>
> </using-query-result>
</v-list-item>
</template>
</using-query-result>
</v-lazy>
</v-expansion-panel-text>
</v-expansion-panel>
</template> </template>
<style scoped></style> <style scoped></style>

View file

@ -10,6 +10,10 @@
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const route = useRoute(); const route = useRoute();
const props = defineProps<{
learningObjectHruid: string;
}>();
const navigationDrawerShown = ref(true); const navigationDrawerShown = ref(true);
const currentLocale = ref(locale.value); const currentLocale = ref(locale.value);
const expanded = ref([route.params.hruid]); const expanded = ref([route.params.hruid]);
@ -40,12 +44,23 @@
:query-result="allLearningPathsResult" :query-result="allLearningPathsResult"
v-slot="learningPaths: { data: LearningPath[] }" v-slot="learningPaths: { data: LearningPath[] }"
> >
<DiscussionSideBarElement <v-expansion-panel
v-for="learningPath in learningPaths.data" v-for="learningPath in learningPaths.data"
:path="learningPath"
:activeObjectId="'' as string"
:key="learningPath.hruid" :key="learningPath.hruid"
/> :value="learningPath.hruid"
>
<v-expansion-panel-title>
{{ learningPath.title }}
</v-expansion-panel-title>
<v-expansion-panel-text>
<v-lazy>
<DiscussionSideBarElement
:path="learningPath"
:activeObjectId="props.learningObjectHruid"
/>
</v-lazy>
</v-expansion-panel-text>
</v-expansion-panel>
</using-query-result> </using-query-result>
</v-expansion-panels> </v-expansion-panels>
</div> </div>

View file

@ -75,7 +75,7 @@
</script> </script>
<template> <template>
<DiscussionsSideBar></DiscussionsSideBar> <DiscussionsSideBar :learningObjectHruid="props.learningObjectHruid"> </DiscussionsSideBar>
<div class="discussions-container"> <div class="discussions-container">
<QuestionBox <QuestionBox
:hruid="props.hruid" :hruid="props.hruid"