feat(frontend): Verbeteringen i18n en standaardleerpad bij het aanmaken

This commit is contained in:
Gerald Schmittinger 2025-05-16 12:48:40 +02:00
parent 60d11e5b0d
commit bf1a90313d
7 changed files with 28 additions and 13 deletions

View file

@ -44,11 +44,11 @@ export class LearningPathController extends BaseController {
return await this.get<LearningPathDTO[]>("/", { admin });
}
async postLearningPath(learningPath: LearningPathDTO): Promise<LearningPathDTO> {
async postLearningPath(learningPath: Partial<LearningPathDTO>): Promise<LearningPathDTO> {
return await this.post<LearningPathDTO>("/", learningPath);
}
async putLearningPath(learningPath: LearningPathDTO): Promise<LearningPathDTO> {
async putLearningPath(learningPath: Partial<LearningPathDTO>): Promise<LearningPathDTO> {
return await this.put<LearningPathDTO>(`/${learningPath.hruid}/${learningPath.language}`, learningPath);
}

View file

@ -162,5 +162,9 @@
"ownLearningContentTitle": "Eigene Lerninhalte",
"ownLearningContentDescription": "Erstellen und verwalten Sie eigene Lernobjekte und Lernpfade. Nur für fortgeschrittene Nutzer.",
"learningPathNotFound": "Dieser Lernpfad konnte nicht gefunden werden.",
"emptyLearningPath": "Dieser Lernpfad enthält keine Lernobjekte."
"emptyLearningPath": "Dieser Lernpfad enthält keine Lernobjekte.",
"pathContainsNonExistingLearningObjects": "Mindestens eines der in diesem Pfad referenzierten Lernobjekte existiert nicht.",
"targetAgesMandatory": "Zielalter müssen angegeben werden.",
"hintRemoveIfUnconditionalTransition": "(entfernen, wenn dies ein bedingungsloser Übergang sein soll)",
"hintKeywordsSeparatedBySpaces": "Schlüsselwörter durch Leerzeichen getrennt"
}

View file

@ -162,5 +162,9 @@
"ownLearningContentTitle": "Own learning content",
"ownLearningContentDescription": "Create and administrate your own learning objects and learning paths. For advanced users only.",
"learningPathNotFound": "This learning path could not be found.",
"emptyLearningPath": "This learning path does not contain any learning objects."
"emptyLearningPath": "This learning path does not contain any learning objects.",
"pathContainsNonExistingLearningObjects": "At least one of the learning objects referenced in this path does not exist.",
"targetAgesMandatory": "Target ages must be specified.",
"hintRemoveIfUnconditionalTransition": "(remove this if this should be an unconditional transition)",
"hintKeywordsSeparatedBySpaces": "Keywords separated by spaces"
}

View file

@ -163,5 +163,9 @@
"ownLearningContentTitle": "Contenu dapprentissage personnel",
"ownLearningContentDescription": "Créez et gérez vos propres objets et parcours dapprentissage. Réservé aux utilisateurs avancés.",
"learningPathNotFound": "Ce parcours d'apprentissage est introuvable.",
"emptyLearningPath": "Ce parcours d'apprentissage ne contient aucun objet d'apprentissage."
"emptyLearningPath": "Ce parcours d'apprentissage ne contient aucun objet d'apprentissage.",
"pathContainsNonExistingLearningObjects": "Au moins un des objets dapprentissage référencés dans ce chemin nexiste pas.",
"targetAgesMandatory": "Les âges cibles doivent être spécifiés.",
"hintRemoveIfUnconditionalTransition": "(supprimer ceci sil sagit dune transition inconditionnelle)",
"hintKeywordsSeparatedBySpaces": "Mots-clés séparés par des espaces"
}

View file

@ -162,5 +162,9 @@
"ownLearningContentTitle": "Eigen leerinhoud",
"ownLearningContentDescription": "Maak en beheer je eigen leerobjecten en leerpads. Alleen voor gevorderde gebruikers.",
"learningPathNotFound": "Dit leerpad kon niet gevonden worden.",
"emptyLearningPath": "Dit leerpad bevat geen leerobjecten."
"emptyLearningPath": "Dit leerpad bevat geen leerobjecten.",
"pathContainsNonExistingLearningObjects": "Ten minste één van de leerobjecten in dit pad bestaat niet.",
"targetAgesMandatory": "Doelleeftijden moeten worden opgegeven.",
"hintRemoveIfUnconditionalTransition": "(verwijder dit voor onvoorwaardelijke overgangen)",
"hintKeywordsSeparatedBySpaces": "Trefwoorden gescheiden door spaties"
}

View file

@ -54,7 +54,7 @@ export function useGetAllLearningPathsByAdminQuery(
export function usePostLearningPathMutation(): UseMutationReturnType<
LearningPathDTO,
AxiosError,
{ learningPath: LearningPathDTO },
{ learningPath: Partial<LearningPathDTO> },
unknown
> {
const queryClient = useQueryClient();
@ -68,7 +68,7 @@ export function usePostLearningPathMutation(): UseMutationReturnType<
export function usePutLearningPathMutation(): UseMutationReturnType<
LearningPathDTO,
AxiosError,
{ learningPath: LearningPathDTO },
{ learningPath: Partial<LearningPathDTO> },
unknown
> {
const queryClient = useQueryClient();

View file

@ -21,7 +21,7 @@
const { isPending, mutate, error: deleteError, isSuccess: deleteSuccess } = useDeleteLearningPathMutation();
const DEFAULT_LEARNING_PATH: LearningPath = {
const DEFAULT_LEARNING_PATH: Partial<LearningPath> = {
language: "en",
hruid: "...",
title: "...",
@ -35,7 +35,7 @@
transitions: [
{
default: true,
condition: "(remove if the transition should be unconditinal)",
condition: t("hintRemoveIfUnconditionalTransition"),
next: {
hruid: "...",
version: 1,
@ -45,14 +45,13 @@
],
},
],
keywords: "Keywords separated by spaces",
target_ages: [],
keywords: t("hintKeywordsSeparatedBySpaces")
};
const { isPending: isPostPending, error: postError, mutate: doPost } = usePostLearningPathMutation();
const { isPending: isPutPending, error: putError, mutate: doPut } = usePutLearningPathMutation();
const learningPath: Ref<LearningPath | string> = ref(DEFAULT_LEARNING_PATH);
const learningPath: Ref<Partial<LearningPath> | string> = ref(DEFAULT_LEARNING_PATH);
const parsedLearningPath = computed(() =>
typeof learningPath.value === "string" ? (JSON.parse(learningPath.value) as LearningPath) : learningPath.value,