diff --git a/frontend/src/components/LearningPathsGrid.vue b/frontend/src/components/LearningPathsGrid.vue new file mode 100644 index 00000000..aeaf5003 --- /dev/null +++ b/frontend/src/components/LearningPathsGrid.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/frontend/src/controllers/learning-paths.ts b/frontend/src/controllers/learning-paths.ts index 19c7d545..c729c7e9 100644 --- a/frontend/src/controllers/learning-paths.ts +++ b/frontend/src/controllers/learning-paths.ts @@ -21,4 +21,8 @@ export class LearningPathController extends BaseController { }); return LearningPath.fromDTO(single(dtos)); } + async getAllByTheme(theme: string) { + let dtos = await this.get("/", {theme}); + return dtos.map(dto => LearningPath.fromDTO(dto)); + } } diff --git a/frontend/src/data-objects/learning-path.ts b/frontend/src/data-objects/learning-path.ts index 525f8a62..ddafb41f 100644 --- a/frontend/src/data-objects/learning-path.ts +++ b/frontend/src/data-objects/learning-path.ts @@ -1,6 +1,4 @@ import type {Language} from "@/data-objects/language.ts"; -import type {LearningObject} from "@/data-objects/learning-object.ts"; -import {getLearningObjectMetadata} from "@/services/learning-content/learning-object-service.ts"; export interface LearningPathDTO { language: string; @@ -54,10 +52,6 @@ export class LearningPathNode { ) { } - get learningObject(): Promise { - return getLearningObjectMetadata(this.learningobjectHruid, this.language, this.version); - } - static fromDTOAndOtherNodes(dto: LearningPathNodeDTO, otherNodes: LearningPathNodeDTO[]): LearningPathNode { return new LearningPathNode( dto.learningobject_hruid, diff --git a/frontend/src/queries/learning-paths.ts b/frontend/src/queries/learning-paths.ts index 3ff44799..ca0dac10 100644 --- a/frontend/src/queries/learning-paths.ts +++ b/frontend/src/queries/learning-paths.ts @@ -22,6 +22,18 @@ export function useGetLearningPathQuery( }) } +export function useGetAllLearningPathsByThemeQuery( + theme: MaybeRefOrGetter +): UseQueryReturnType { + return useQuery({ + queryKey: [LEARNING_PATH_KEY, "getAllByTheme", theme], + queryFn: () => { + return learningPathController.getAllByTheme(toValue(theme)) + }, + enabled: () => Boolean(toValue(theme)), + }) +} + export function useSearchLearningPathQuery( query: MaybeRefOrGetter ): UseQueryReturnType { diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 1241a5d3..f03658eb 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -65,9 +65,10 @@ const router = createRouter({ }, { - path: "/theme/:id", + path: "/theme/:theme", name: "Theme", component: SingleTheme, + props: true, meta: { requiresAuth: true }, }, { diff --git a/frontend/src/views/SingleTheme.vue b/frontend/src/views/SingleTheme.vue index 1a35a59f..6d88636d 100644 --- a/frontend/src/views/SingleTheme.vue +++ b/frontend/src/views/SingleTheme.vue @@ -1,7 +1,67 @@ - + - + diff --git a/frontend/src/views/learning-paths/LearningPathSearchPage.vue b/frontend/src/views/learning-paths/LearningPathSearchPage.vue index 79c39e2c..baafb0cc 100644 --- a/frontend/src/views/learning-paths/LearningPathSearchPage.vue +++ b/frontend/src/views/learning-paths/LearningPathSearchPage.vue @@ -3,10 +3,10 @@ import {useRoute, useRouter} from "vue-router"; import {computed} from "vue"; import {useI18n} from "vue-i18n"; - import {convertBase64ToImageSrc} from "@/utils/base64ToImage.ts"; import LearningPathSearchField from "@/components/LearningPathSearchField.vue"; import {useSearchLearningPathQuery} from "@/queries/learning-paths.ts"; import UsingQueryResult from "@/components/UsingQueryResult.vue"; + import LearningPathsGrid from "@/components/LearningPathsGrid.vue"; const route = useRoute(); const router = useRouter(); @@ -23,34 +23,7 @@ -
- - - {{ learningPath.title }} - - - {{ learningPath.targetAges.min }} - {{ learningPath.targetAges.max }} {{ t('yearsAge') }} - - {{ learningPath.description }} - -
-
- -
+