From df64c0a4b5397a5f4d476e0c8fa5da83c0833c36 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Tue, 30 Dec 2025 18:44:35 +0100 Subject: [PATCH] Update VocabPracticeDialog and VocabChapterView components to manage practice dialog state - Changed the close button visibility in VocabPracticeDialog to false for a cleaner UI. - Enhanced VocabChapterView to manage the practice dialog state with a new `practiceOpen` flag. - Updated the `openPractice` method to handle the dialog's open and close events, ensuring proper state management. --- .../socialnetwork/VocabPracticeDialog.vue | 12 ++- .../src/views/social/VocabChapterView.vue | 81 ++++++++++--------- 2 files changed, 53 insertions(+), 40 deletions(-) diff --git a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue index 21c9492..1110b15 100644 --- a/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue +++ b/frontend/src/dialogues/socialnetwork/VocabPracticeDialog.vue @@ -2,7 +2,7 @@
@@ -112,6 +111,7 @@ export default { data() { return { openParams: null, // { languageId, chapterId } + onClose: null, loading: false, allVocabs: false, simpleMode: false, @@ -168,12 +168,13 @@ export default { }, }, methods: { - open({ languageId, chapterId }) { + open({ languageId, chapterId, onClose = null }) { if (this.autoAdvanceTimer) { clearTimeout(this.autoAdvanceTimer); this.autoAdvanceTimer = null; } this.openParams = { languageId, chapterId }; + this.onClose = typeof onClose === 'function' ? onClose : null; this.allVocabs = false; this.simpleMode = false; this.correctCount = 0; @@ -191,7 +192,12 @@ export default { clearTimeout(this.autoAdvanceTimer); this.autoAdvanceTimer = null; } + const cb = this.onClose; + this.onClose = null; this.$refs.dialog.close(); + try { + if (cb) cb(); + } catch (_) {} }, normalize(s) { return String(s || '') diff --git a/frontend/src/views/social/VocabChapterView.vue b/frontend/src/views/social/VocabChapterView.vue index a40c748..d7cf7cd 100644 --- a/frontend/src/views/social/VocabChapterView.vue +++ b/frontend/src/views/social/VocabChapterView.vue @@ -5,45 +5,47 @@
{{ $t('general.loading') }}
{{ $t('socialnetwork.vocab.notFound') }}
-
- - -
- -
-

{{ $t('socialnetwork.vocab.addVocab') }}

-
- - +
+
+ +
- + +
+

{{ $t('socialnetwork.vocab.addVocab') }}

+
+ + +
+ +
+ +
+ +
{{ $t('socialnetwork.vocab.noVocabs') }}
+ + + + + + + + + + + + + +
{{ $t('socialnetwork.vocab.learningWord') }}{{ $t('socialnetwork.vocab.referenceWord') }}
{{ v.learning }}{{ v.reference }}
- -
- -
{{ $t('socialnetwork.vocab.noVocabs') }}
- - - - - - - - - - - - - -
{{ $t('socialnetwork.vocab.learningWord') }}{{ $t('socialnetwork.vocab.referenceWord') }}
{{ v.learning }}{{ v.reference }}
@@ -61,6 +63,7 @@ export default { return { loading: false, saving: false, + practiceOpen: false, chapter: null, vocabs: [], learning: '', @@ -77,9 +80,13 @@ export default { this.$router.push(`/socialnetwork/vocab/${this.$route.params.languageId}`); }, openPractice() { + this.practiceOpen = true; this.$refs.practiceDialog?.open?.({ languageId: this.$route.params.languageId, chapterId: this.$route.params.chapterId, + onClose: () => { + this.practiceOpen = false; + }, }); }, async load() {