diff --git a/client/src/pages/learningPath/learningContentPage/LearningContentParent.vue b/client/src/pages/learningPath/learningContentPage/LearningContentParent.vue index e34bae26..5d5cb0ee 100644 --- a/client/src/pages/learningPath/learningContentPage/LearningContentParent.vue +++ b/client/src/pages/learningPath/learningContentPage/LearningContentParent.vue @@ -1,5 +1,6 @@ + + diff --git a/client/src/services/circle.ts b/client/src/services/circle.ts index 7cacaff2..1455c12e 100644 --- a/client/src/services/circle.ts +++ b/client/src/services/circle.ts @@ -14,11 +14,13 @@ import type { import groupBy from "lodash/groupBy"; import partition from "lodash/partition"; import values from "lodash/values"; +import log from "loglevel"; function isLearningContentType(object: any): object is LearningContent { return ( object?.content_type === "learnpath.LearningContentAssignment" || object?.content_type === "learnpath.LearningContentAttendanceCourse" || + object?.content_type === "learnpath.LearningContentDocumentList" || object?.content_type === "learnpath.LearningContentFeedback" || object?.content_type === "learnpath.LearningContentLearningModule" || object?.content_type === "learnpath.LearningContentMediaLibrary" || @@ -83,6 +85,7 @@ export function parseLearningSequences( learningUnit.learningContents.push(child); } else { + log.error("Unknown CircleChild found...", child); throw new Error("Unknown CircleChild found..."); } }); diff --git a/client/src/types.ts b/client/src/types.ts index 1a090d74..5a1a0fb7 100644 --- a/client/src/types.ts +++ b/client/src/types.ts @@ -23,6 +23,7 @@ export interface CircleLight { export type LearningContent = | LearningContentAssignment | LearningContentAttendanceCourse + | LearningContentDocumentList | LearningContentFeedback | LearningContentLearningModule | LearningContentMediaLibrary @@ -55,6 +56,17 @@ export interface LearningContentAttendanceCourse extends LearningContentInterfac 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 { readonly content_type: "learnpath.LearningContentFeedback"; } diff --git a/client/src/utils/typeMaps.ts b/client/src/utils/typeMaps.ts index fa443537..96d8bb34 100644 --- a/client/src/utils/typeMaps.ts +++ b/client/src/utils/typeMaps.ts @@ -26,6 +26,8 @@ export function learningContentTypeData( } case "learnpath.LearningContentAttendanceCourse": return { title: "Präsenzkurs", icon: "it-icon-lc-training" }; + case "learnpath.LearningContentDocumentList": + return { title: "Dokumente", icon: "it-icon-lc-document" }; case "learnpath.LearningContentLearningModule": return { title: "Lernmodul", icon: "it-icon-lc-learning-module" }; case "learnpath.LearningContentMediaLibrary": @@ -42,5 +44,5 @@ export function learningContentTypeData( return { title: "In Umsetzung", icon: "it-icon-lc-document" }; } - return assertUnreachable(); + return assertUnreachable(`did not handle ${lc.content_type}`); } diff --git a/client/src/utils/utils.ts b/client/src/utils/utils.ts index c6a55326..52bceeee 100644 --- a/client/src/utils/utils.ts +++ b/client/src/utils/utils.ts @@ -1,3 +1,3 @@ -export function assertUnreachable(): never { - throw new Error("Didn't expect to get here"); +export function assertUnreachable(msg: string): never { + throw new Error("Didn't expect to get here, " + msg); }