diff --git a/frontend/src/components/LearningPathSearchField.vue b/frontend/src/components/LearningPathSearchField.vue new file mode 100644 index 00000000..d9e9f85d --- /dev/null +++ b/frontend/src/components/LearningPathSearchField.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/frontend/src/i18n/locale/de.json b/frontend/src/i18n/locale/de.json index 13638aaa..ad660e3b 100644 --- a/frontend/src/i18n/locale/de.json +++ b/frontend/src/i18n/locale/de.json @@ -2,5 +2,11 @@ "welcome": "Willkommen", "error_title": "Fehler", "previous": "Zurück", - "next": "Weiter" + "next": "Weiter", + "search": "Suchen...", + "yearsAge": "Jahre", + "enterSearchTerm": "Lernpfade suchen", + "enterSearchTermDescription": "Bitte geben Sie einen Suchbegriff ein.", + "noLearningPathsFound": "Nichts gefunden!", + "noLearningPathsFoundDescription": "Es gibt keine Lernpfade, die zu Ihrem Suchbegriff passen." } diff --git a/frontend/src/i18n/locale/en.json b/frontend/src/i18n/locale/en.json index 3e149759..a8889ec1 100644 --- a/frontend/src/i18n/locale/en.json +++ b/frontend/src/i18n/locale/en.json @@ -8,5 +8,11 @@ "logout": "log out", "error_title": "Error", "previous": "Previous", - "next": "Next" + "next": "Next", + "search": "Search...", + "yearsAge": "years", + "enterSearchTerm": "Search learning paths", + "enterSearchTermDescription": "Please enter a search term.", + "noLearningPathsFound": "Nothing found!", + "noLearningPathsFoundDescription": "There are no learning paths matching your search term." } diff --git a/frontend/src/i18n/locale/fr.json b/frontend/src/i18n/locale/fr.json index 924dc94b..a4f2d4d7 100644 --- a/frontend/src/i18n/locale/fr.json +++ b/frontend/src/i18n/locale/fr.json @@ -2,5 +2,12 @@ "welcome": "Bienvenue", "error_title": "Erreur", "previous": "Précédente", - "next": "Suivante" + "next": "Suivante", + "search": "Réchercher...", + "yearsAge": "ans", + "enterSearchTerm": "Rechercher des parcours d'apprentissage", + "enterSearchTermDescription": "Saisissez un terme de recherche pour commencer.", + "noLearningPathsFound": "Rien trouvé !", + "noLearningPathsFoundDescription": "Aucun parcours d'apprentissage ne correspond à votre recherche." + } diff --git a/frontend/src/i18n/locale/nl.json b/frontend/src/i18n/locale/nl.json index 8e058396..2b212809 100644 --- a/frontend/src/i18n/locale/nl.json +++ b/frontend/src/i18n/locale/nl.json @@ -8,5 +8,11 @@ "logout": "log uit", "error_title": "Fout", "previous": "Vorige", - "next": "Volgende" + "next": "Volgende", + "search": "Zoeken...", + "yearsAge": "jaar", + "enterSearchTerm": "Zoek naar leerpaden", + "enterSearchTermDescription": "Gelieve een zoekterm in te voeren.", + "noLearningPathsFound": "Niets gevonden!", + "noLearningPathsFoundDescription": "Er zijn geen leerpaden die overeenkomen met je zoekterm." } diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index f096a0ba..263ba279 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -15,6 +15,7 @@ import UserAssignments from "@/views/classes/UserAssignments.vue"; import authState from "@/services/auth/auth-service.ts"; import LearningPathPage from "@/views/learning-paths/LearningPathPage.vue"; import path from "path"; +import LearningPathSearchPage from "@/views/learning-paths/LearningPathSearchPage.vue"; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -101,6 +102,12 @@ const router = createRouter({ component: SingleDiscussion, meta: { requiresAuth: true }, }, + { + path: "/learningPath/search", + name: "LearningPathSearchPage", + component: LearningPathSearchPage, + meta: { requiresAuth: false } + }, { path: "/learningPath/:hruid/:language", name: "LearningPath", diff --git a/frontend/src/services/learning-content/learning-path.ts b/frontend/src/services/learning-content/learning-path.ts index 2bbef7f2..31b6f426 100644 --- a/frontend/src/services/learning-content/learning-path.ts +++ b/frontend/src/services/learning-content/learning-path.ts @@ -117,9 +117,10 @@ export class LearningPath { } static fromDTO(dto: LearningPathDTO): LearningPath { - let startNodeDto = dto.nodes.filter(it => it.start_node); + let startNodeDto = dto.nodes.filter(it => it.start_node === true); if (startNodeDto.length !== 1) { - throw new Error(`Invalid learning path! Expected precisely one start node, but there were ${startNodeDto.length}.`); + throw new Error(`Invalid learning path: ${dto.hruid}/${dto.language}! + Expected precisely one start node, but there were ${startNodeDto.length}.`); } return new LearningPath( dto.language, @@ -130,7 +131,8 @@ export class LearningPath { dto.num_nodes_left, dto.keywords.split(' '), {min: dto.min_age, max: dto.max_age}, - LearningPathNode.fromDTOAndOtherNodes(startNodeDto[0], dto.nodes) + LearningPathNode.fromDTOAndOtherNodes(startNodeDto[0], dto.nodes), + dto.image ) } } diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index 61f4b35b..72c00ce0 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -9,6 +9,7 @@ import {loadResource, remoteResource, type SuccessState} from "@/services/api-client/remote-resource.ts"; import LearningObjectView from "@/views/learning-paths/LearningObjectView.vue"; import {useI18n} from "vue-i18n"; + import LearningPathSearchField from "@/components/LearningPathSearchField.vue"; const router = useRouter(); const route = useRoute(); @@ -128,11 +129,17 @@ - +
+ +
+ +
+
+