Wire document list to frontend
This commit is contained in:
parent
904d24f566
commit
9937951728
|
|
@ -1,5 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import LearningContentContainer from "@/pages/learningPath/learningContentPage/LearningContentContainer.vue";
|
import LearningContentContainer from "@/pages/learningPath/learningContentPage/LearningContentContainer.vue";
|
||||||
|
import DocumentListBlock from "@/pages/learningPath/learningContentPage/blocks/DocumentListBlock.vue";
|
||||||
import { useCircleStore } from "@/stores/circle";
|
import { useCircleStore } from "@/stores/circle";
|
||||||
import type { LearningContent, LearningContentType } from "@/types";
|
import type { LearningContent, LearningContentType } from "@/types";
|
||||||
import eventBus from "@/utils/eventBus";
|
import eventBus from "@/utils/eventBus";
|
||||||
|
|
@ -27,6 +28,7 @@ log.debug("LearningContentParent setup", props.learningContent);
|
||||||
const COMPONENTS: Record<LearningContentType, Component> = {
|
const COMPONENTS: Record<LearningContentType, Component> = {
|
||||||
"learnpath.LearningContentAssignment": AssignmentBlock,
|
"learnpath.LearningContentAssignment": AssignmentBlock,
|
||||||
"learnpath.LearningContentAttendanceCourse": AttendanceCourseBlock,
|
"learnpath.LearningContentAttendanceCourse": AttendanceCourseBlock,
|
||||||
|
"learnpath.LearningContentDocumentList": DocumentListBlock,
|
||||||
"learnpath.LearningContentFeedback": FeedbackBlock,
|
"learnpath.LearningContentFeedback": FeedbackBlock,
|
||||||
"learnpath.LearningContentLearningModule": IframeBlock,
|
"learnpath.LearningContentLearningModule": IframeBlock,
|
||||||
"learnpath.LearningContentMediaLibrary": MediaLibraryBlock,
|
"learnpath.LearningContentMediaLibrary": MediaLibraryBlock,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { LearningContentDocumentList } from "@/types";
|
||||||
|
import LearningContentSimpleLayout from "../layouts/LearningContentSimpleLayout.vue";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
content: LearningContentDocumentList;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<LearningContentSimpleLayout :title="content.title" :learning-content="props.content">
|
||||||
|
<div class="container-medium">
|
||||||
|
<div class="lg:mt-8">
|
||||||
|
<div class="text-large my-4">List von Docs</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</LearningContentSimpleLayout>
|
||||||
|
</template>
|
||||||
|
|
@ -14,11 +14,13 @@ import type {
|
||||||
import groupBy from "lodash/groupBy";
|
import groupBy from "lodash/groupBy";
|
||||||
import partition from "lodash/partition";
|
import partition from "lodash/partition";
|
||||||
import values from "lodash/values";
|
import values from "lodash/values";
|
||||||
|
import log from "loglevel";
|
||||||
|
|
||||||
function isLearningContentType(object: any): object is LearningContent {
|
function isLearningContentType(object: any): object is LearningContent {
|
||||||
return (
|
return (
|
||||||
object?.content_type === "learnpath.LearningContentAssignment" ||
|
object?.content_type === "learnpath.LearningContentAssignment" ||
|
||||||
object?.content_type === "learnpath.LearningContentAttendanceCourse" ||
|
object?.content_type === "learnpath.LearningContentAttendanceCourse" ||
|
||||||
|
object?.content_type === "learnpath.LearningContentDocumentList" ||
|
||||||
object?.content_type === "learnpath.LearningContentFeedback" ||
|
object?.content_type === "learnpath.LearningContentFeedback" ||
|
||||||
object?.content_type === "learnpath.LearningContentLearningModule" ||
|
object?.content_type === "learnpath.LearningContentLearningModule" ||
|
||||||
object?.content_type === "learnpath.LearningContentMediaLibrary" ||
|
object?.content_type === "learnpath.LearningContentMediaLibrary" ||
|
||||||
|
|
@ -83,6 +85,7 @@ export function parseLearningSequences(
|
||||||
|
|
||||||
learningUnit.learningContents.push(child);
|
learningUnit.learningContents.push(child);
|
||||||
} else {
|
} else {
|
||||||
|
log.error("Unknown CircleChild found...", child);
|
||||||
throw new Error("Unknown CircleChild found...");
|
throw new Error("Unknown CircleChild found...");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ export interface CircleLight {
|
||||||
export type LearningContent =
|
export type LearningContent =
|
||||||
| LearningContentAssignment
|
| LearningContentAssignment
|
||||||
| LearningContentAttendanceCourse
|
| LearningContentAttendanceCourse
|
||||||
|
| LearningContentDocumentList
|
||||||
| LearningContentFeedback
|
| LearningContentFeedback
|
||||||
| LearningContentLearningModule
|
| LearningContentLearningModule
|
||||||
| LearningContentMediaLibrary
|
| LearningContentMediaLibrary
|
||||||
|
|
@ -55,6 +56,17 @@ export interface LearningContentAttendanceCourse extends LearningContentInterfac
|
||||||
readonly content_type: "learnpath.LearningContentAttendanceCourse";
|
readonly content_type: "learnpath.LearningContentAttendanceCourse";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface LearningContentDocument {
|
||||||
|
readonly type: "document";
|
||||||
|
readonly id: string;
|
||||||
|
readonly value: MediaLibraryContentBlockValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LearningContentDocumentList extends LearningContentInterface {
|
||||||
|
readonly content_type: "learnpath.LearningContentDocumentList";
|
||||||
|
readonly documents: LearningContentDocument[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface LearningContentFeedback extends LearningContentInterface {
|
export interface LearningContentFeedback extends LearningContentInterface {
|
||||||
readonly content_type: "learnpath.LearningContentFeedback";
|
readonly content_type: "learnpath.LearningContentFeedback";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ export function learningContentTypeData(
|
||||||
}
|
}
|
||||||
case "learnpath.LearningContentAttendanceCourse":
|
case "learnpath.LearningContentAttendanceCourse":
|
||||||
return { title: "Präsenzkurs", icon: "it-icon-lc-training" };
|
return { title: "Präsenzkurs", icon: "it-icon-lc-training" };
|
||||||
|
case "learnpath.LearningContentDocumentList":
|
||||||
|
return { title: "Dokumente", icon: "it-icon-lc-document" };
|
||||||
case "learnpath.LearningContentLearningModule":
|
case "learnpath.LearningContentLearningModule":
|
||||||
return { title: "Lernmodul", icon: "it-icon-lc-learning-module" };
|
return { title: "Lernmodul", icon: "it-icon-lc-learning-module" };
|
||||||
case "learnpath.LearningContentMediaLibrary":
|
case "learnpath.LearningContentMediaLibrary":
|
||||||
|
|
@ -42,5 +44,5 @@ export function learningContentTypeData(
|
||||||
return { title: "In Umsetzung", icon: "it-icon-lc-document" };
|
return { title: "In Umsetzung", icon: "it-icon-lc-document" };
|
||||||
}
|
}
|
||||||
|
|
||||||
return assertUnreachable();
|
return assertUnreachable(`did not handle ${lc.content_type}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export function assertUnreachable(): never {
|
export function assertUnreachable(msg: string): never {
|
||||||
throw new Error("Didn't expect to get here");
|
throw new Error("Didn't expect to get here, " + msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue