295 lines
6.9 KiB
TypeScript
295 lines
6.9 KiB
TypeScript
import type { Circle } from "@/services/circle";
|
|
import type { Component } from "vue";
|
|
|
|
export type CourseCompletionStatus = "unknown" | "fail" | "success";
|
|
|
|
|
|
export interface BaseCourseWagtailPage {
|
|
readonly id: number;
|
|
readonly title: string;
|
|
readonly slug: string;
|
|
readonly type: string;
|
|
readonly translation_key: string;
|
|
readonly frontend_url: string;
|
|
completion_status?: CourseCompletionStatus;
|
|
completion_status_updated_at?: string;
|
|
}
|
|
|
|
export interface CircleLight {
|
|
readonly id: number;
|
|
readonly title: string;
|
|
readonly translation_key: string;
|
|
}
|
|
|
|
export interface BaseLearningContentBlock {
|
|
readonly type: string;
|
|
readonly id: string;
|
|
readonly value: {
|
|
description: string;
|
|
url: string;
|
|
text?: string;
|
|
};
|
|
}
|
|
|
|
export interface AssignmentBlock extends BaseLearningContentBlock {
|
|
readonly type: "assignment";
|
|
}
|
|
|
|
export interface BookBlock extends BaseLearningContentBlock {
|
|
readonly type: "book";
|
|
}
|
|
|
|
export interface DocumentBlock extends BaseLearningContentBlock {
|
|
readonly type: "document";
|
|
}
|
|
|
|
export interface ExerciseBlock extends BaseLearningContentBlock {
|
|
readonly type: "exercise";
|
|
}
|
|
|
|
export interface MediaLibraryBlock extends BaseLearningContentBlock {
|
|
readonly type: "media_library";
|
|
}
|
|
|
|
export interface OnlineTrainingBlock extends BaseLearningContentBlock {
|
|
readonly type: "online_training";
|
|
}
|
|
|
|
export interface ResourceBlock extends BaseLearningContentBlock {
|
|
readonly type: "resource";
|
|
}
|
|
|
|
export interface TestBlock extends BaseLearningContentBlock {
|
|
readonly type: "test";
|
|
}
|
|
|
|
export interface VideoBlock extends BaseLearningContentBlock {
|
|
readonly type: "video";
|
|
}
|
|
|
|
export interface PlaceholderBlock extends BaseLearningContentBlock {
|
|
readonly type: "placeholder";
|
|
}
|
|
|
|
export type LearningContentBlock =
|
|
| AssignmentBlock
|
|
| BookBlock
|
|
| DocumentBlock
|
|
| ExerciseBlock
|
|
| MediaLibraryBlock
|
|
| OnlineTrainingBlock
|
|
| ResourceBlock
|
|
| TestBlock
|
|
| VideoBlock
|
|
| PlaceholderBlock;
|
|
|
|
export type LearningContentType = LearningContentBlock["type"];
|
|
|
|
export interface LearningContent extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.LearningContent";
|
|
minutes: number;
|
|
contents: LearningContentBlock[];
|
|
parentCircle: Circle;
|
|
parentLearningSequence?: LearningSequence;
|
|
parentLearningUnit?: LearningUnit;
|
|
nextLearningContent?: LearningContent;
|
|
previousLearningContent?: LearningContent;
|
|
}
|
|
|
|
export interface LearningUnitPerformanceCriteria extends BaseCourseWagtailPage {
|
|
readonly type: "competence.PerformanceCriteria";
|
|
readonly competence_id: string;
|
|
parentLearningSequence?: LearningSequence;
|
|
parentLearningUnit?: LearningUnit;
|
|
}
|
|
|
|
export interface LearningUnit extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.LearningUnit";
|
|
readonly evaluate_url: string;
|
|
readonly course_category: CourseCategory;
|
|
children: LearningUnitPerformanceCriteria[];
|
|
|
|
// additional frontend fields
|
|
learningContents: LearningContent[];
|
|
minutes: number;
|
|
parentLearningSequence?: LearningSequence;
|
|
parentCircle?: Circle;
|
|
last?: boolean;
|
|
}
|
|
|
|
export interface LearningSequence extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.LearningSequence";
|
|
icon: string;
|
|
learningUnits: LearningUnit[];
|
|
minutes: number;
|
|
}
|
|
|
|
export type CircleChild = LearningContent | LearningUnit | LearningSequence;
|
|
|
|
export interface WagtailLearningPath extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.LearningPath";
|
|
course: Course;
|
|
children: LearningPathChild[];
|
|
}
|
|
|
|
export interface CircleGoal {
|
|
type: "goal";
|
|
value: string;
|
|
id: string;
|
|
}
|
|
|
|
export interface CircleJobSituation {
|
|
type: "job_situation";
|
|
value: string;
|
|
id: string;
|
|
}
|
|
|
|
export interface WagtailCircle extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.Circle";
|
|
readonly description: string;
|
|
readonly goal_description: string;
|
|
readonly goals: CircleGoal[];
|
|
readonly job_situation_description: string;
|
|
readonly job_situations: CircleJobSituation[];
|
|
readonly children: CircleChild[];
|
|
}
|
|
|
|
export interface Topic extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.Topic";
|
|
readonly is_visible: boolean;
|
|
circles: Circle[];
|
|
}
|
|
|
|
export type LearningPathChild = Topic | WagtailCircle;
|
|
|
|
export interface CourseCompletion {
|
|
id: number;
|
|
created_at: string;
|
|
updated_at: string;
|
|
user: number;
|
|
page_key: string;
|
|
page_type: string;
|
|
page_slug: string;
|
|
course: number;
|
|
completion_status: CourseCompletionStatus;
|
|
additional_json_data: unknown;
|
|
}
|
|
|
|
export interface CircleDiagramData {
|
|
index: number;
|
|
title: string;
|
|
icon: string;
|
|
startAngle: number;
|
|
endAngle: number;
|
|
arrowStartAngle: number;
|
|
arrowEndAngle: number;
|
|
done: boolean;
|
|
}
|
|
|
|
export interface Course {
|
|
id: number;
|
|
title: string;
|
|
category_name: string;
|
|
}
|
|
|
|
export interface CourseCategory {
|
|
id: number;
|
|
name: string;
|
|
general: boolean;
|
|
}
|
|
|
|
export type MediaLibraryContentBlockValue = {
|
|
title: string;
|
|
description: string;
|
|
icon_url: string;
|
|
link_display_text: string;
|
|
url: string;
|
|
open_window: boolean;
|
|
};
|
|
|
|
export interface LearnMediaBlock {
|
|
type: "learn_media";
|
|
id: string;
|
|
value: MediaLibraryContentBlockValue;
|
|
}
|
|
|
|
export interface ExternalLinkBlock {
|
|
type: "external_link";
|
|
id: string;
|
|
value: MediaLibraryContentBlockValue;
|
|
}
|
|
|
|
export interface InternalLinkBlock {
|
|
type: "internal_link";
|
|
id: string;
|
|
value: MediaLibraryContentBlockValue;
|
|
}
|
|
|
|
export interface RelativeLinkBlock {
|
|
type: "relative_link";
|
|
id: string;
|
|
value: MediaLibraryContentBlockValue;
|
|
}
|
|
|
|
export interface MediaContentCollection {
|
|
type: "content_collection";
|
|
value: {
|
|
title: string;
|
|
contents: (
|
|
| LearnMediaBlock
|
|
| ExternalLinkBlock
|
|
| InternalLinkBlock
|
|
| RelativeLinkBlock
|
|
)[];
|
|
};
|
|
}
|
|
|
|
export interface MediaCategoryPage extends BaseCourseWagtailPage {
|
|
type: "media_library.MediaCategoryPage";
|
|
overview_icon: string;
|
|
introduction_text: string;
|
|
description_title: string;
|
|
description_text: string;
|
|
items: {
|
|
type: "item";
|
|
value: string;
|
|
id: string;
|
|
};
|
|
course_category: CourseCategory;
|
|
body: MediaContentCollection[];
|
|
}
|
|
|
|
export interface MediaLibraryPage extends BaseCourseWagtailPage {
|
|
readonly type: "media_library.MediaLibraryPage";
|
|
readonly course: Course;
|
|
readonly children: MediaCategoryPage[];
|
|
}
|
|
|
|
export interface PerformanceCriteria extends BaseCourseWagtailPage {
|
|
readonly type: "competence.PerformanceCriteria";
|
|
readonly competence_id: string;
|
|
readonly circle: CircleLight;
|
|
readonly course_category: CourseCategory;
|
|
readonly learning_unit: BaseCourseWagtailPage;
|
|
}
|
|
|
|
export interface CompetencePage extends BaseCourseWagtailPage {
|
|
readonly type: "competence.CompetencePage";
|
|
readonly competence_id: string;
|
|
readonly children: PerformanceCriteria[];
|
|
}
|
|
|
|
export interface CompetenceProfilePage extends BaseCourseWagtailPage {
|
|
readonly type: "competence.CompetenceProfilePage";
|
|
readonly course: Course;
|
|
readonly circles: CircleLight[];
|
|
readonly children: CompetencePage[];
|
|
}
|
|
|
|
// dropdown
|
|
export interface DropdownListItem {
|
|
title: string;
|
|
icon: Component;
|
|
data: object;
|
|
}
|