feat(vocab): add course language name handling in VocabLessonView
All checks were successful
Deploy to production / deploy (push) Successful in 2m48s
All checks were successful
Deploy to production / deploy (push) Successful in 2m48s
- Introduced new properties for course language names to enhance clarity in vocabulary preparation. - Implemented a method to load course language names from the API, improving localization and user experience. - Updated label logic to utilize course-specific language names, ensuring accurate representation in vocabulary lessons.
This commit is contained in:
@@ -1012,6 +1012,8 @@ export default {
|
||||
exerciseSequentialIndex: 0,
|
||||
/** Aus vorherigen Lektionen (MC-Optionen nach Fragentyp Ziel-/Muttersprache) */
|
||||
distractorPool: { target: [], native: [] },
|
||||
courseLanguageName: '',
|
||||
courseNativeLanguageName: '',
|
||||
/** Fortschritt aller Kurslektionen inkl. lessonState für Spezial-Trainer-Boost */
|
||||
courseProgressList: [],
|
||||
/** { [exerciseId]: { options: string[], useTextAnswer: boolean } } */
|
||||
@@ -1297,14 +1299,16 @@ export default {
|
||||
},
|
||||
prepTargetLabel() {
|
||||
return String(
|
||||
this.lesson?.course?.languageName
|
||||
this.courseLanguageName
|
||||
|| this.lesson?.course?.languageName
|
||||
|| this.lesson?.languageName
|
||||
|| this.$t('socialnetwork.vocab.courses.vocabPrepTargetLabel')
|
||||
).toUpperCase();
|
||||
},
|
||||
prepGlossLabel() {
|
||||
return String(
|
||||
this.lesson?.course?.nativeLanguageName
|
||||
this.courseNativeLanguageName
|
||||
|| this.lesson?.course?.nativeLanguageName
|
||||
|| this.lesson?.nativeLanguageName
|
||||
|| this.$t('socialnetwork.vocab.courses.vocabPrepGlossLabel')
|
||||
).toUpperCase();
|
||||
@@ -2133,6 +2137,8 @@ export default {
|
||||
this.vocabTrainerCurrentAttempts = 0;
|
||||
this.vocabTrainerReviewAttempts = 0;
|
||||
this.courseProgressList = [];
|
||||
this.courseLanguageName = '';
|
||||
this.courseNativeLanguageName = '';
|
||||
this.distractorPool = { target: [], native: [] };
|
||||
this.mcRandomizedOptions = {};
|
||||
// Reset Flags
|
||||
@@ -2154,6 +2160,7 @@ export default {
|
||||
try {
|
||||
const res = await apiClient.get(`/api/vocab/lessons/${this.lessonId}`);
|
||||
this.lesson = res.data;
|
||||
await this.loadCourseLanguageNames();
|
||||
await this.loadCourseProgressForBoost();
|
||||
debugLog('[VocabLessonView] Geladene Lektion:', this.lesson?.id, this.lesson?.title);
|
||||
if (this.$route.query.assistant) {
|
||||
@@ -2199,6 +2206,16 @@ export default {
|
||||
this.courseProgressList = [];
|
||||
}
|
||||
},
|
||||
async loadCourseLanguageNames() {
|
||||
try {
|
||||
const { data } = await apiClient.get(`/api/vocab/courses/${this.courseId}`);
|
||||
this.courseLanguageName = String(data?.languageName || '').trim();
|
||||
this.courseNativeLanguageName = String(data?.nativeLanguageName || '').trim();
|
||||
} catch (e) {
|
||||
this.courseLanguageName = '';
|
||||
this.courseNativeLanguageName = '';
|
||||
}
|
||||
},
|
||||
focusAssistantCard() {
|
||||
const target = this.$refs.assistantCard;
|
||||
if (!target || typeof target.scrollIntoView !== 'function') {
|
||||
|
||||
Reference in New Issue
Block a user