From 73844f88130e3320bb31228f9cebe6f1573631a3 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 7 Aug 2025 16:04:36 +0530 Subject: [PATCH] fix: minor changes with visibility and change --- cypress/e2e/course_creation.cy.js | 1 + frappe-ui | 2 +- frontend/components.d.ts | 1 - frontend/package.json | 2 +- .../src/components/Notes/InlineLessonMenu.vue | 29 ++- frontend/src/components/Notes/Notes.vue | 20 +- frontend/src/components/Notes/types.ts | 2 +- frontend/src/pages/Lesson.vue | 65 ++++- frontend/yarn.lock | 223 ++++++------------ 9 files changed, 161 insertions(+), 184 deletions(-) diff --git a/cypress/e2e/course_creation.cy.js b/cypress/e2e/course_creation.cy.js index 06a851df..9a1433c5 100644 --- a/cypress/e2e/course_creation.cy.js +++ b/cypress/e2e/course_creation.cy.js @@ -140,6 +140,7 @@ describe("Course Creation", () => { ); // Add Discussion + cy.get("span").contains("Comments").click(); cy.button("New Question").click(); cy.wait(500); cy.get("[id^=headlessui-dialog-panel-").within(() => { diff --git a/frappe-ui b/frappe-ui index 80d3a010..333dce1a 160000 --- a/frappe-ui +++ b/frappe-ui @@ -1 +1 @@ -Subproject commit 80d3a010acc100850a94b11eb7faf3480013cfb0 +Subproject commit 333dce1a4d13243645403775db613a9b5106994c diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 6ea3a31b..81ea2c52 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -67,7 +67,6 @@ declare module 'vue' { IconPicker: typeof import('./src/components/Controls/IconPicker.vue')['default'] IndicatorIcon: typeof import('./src/components/Icons/IndicatorIcon.vue')['default'] InlineLessonMenu: typeof import('./src/components/Notes/InlineLessonMenu.vue')['default'] - InlineMenu: typeof import('./src/components/InlineMenu.vue')['default'] InviteIcon: typeof import('./src/components/Icons/InviteIcon.vue')['default'] JobApplicationModal: typeof import('./src/components/Modals/JobApplicationModal.vue')['default'] JobCard: typeof import('./src/components/JobCard.vue')['default'] diff --git a/frontend/package.json b/frontend/package.json index d981075a..98cd51a3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -31,7 +31,7 @@ "codemirror": "^6.0.1", "dayjs": "^1.11.6", "feather-icons": "^4.28.0", - "frappe-ui": "^0.1.182", + "frappe-ui": "0.1.173", "highlight.js": "^11.11.1", "lucide-vue-next": "^0.383.0", "markdown-it": "^14.0.0", diff --git a/frontend/src/components/Notes/InlineLessonMenu.vue b/frontend/src/components/Notes/InlineLessonMenu.vue index c753517c..32a1a6d3 100644 --- a/frontend/src/components/Notes/InlineLessonMenu.vue +++ b/frontend/src/components/Notes/InlineLessonMenu.vue @@ -31,7 +31,7 @@
@@ -124,6 +124,7 @@ const saveHighLight = (color: string) => { member: user?.data?.name, highlighted_text: selectedText.value, color: color, + name: '', }, { onSuccess(data: Note) { @@ -148,8 +149,9 @@ const deleteHighlight = () => { onSuccess() { resetStates() document.querySelectorAll('.highlighted-text').forEach((el) => { - if (el.dataset.name === notesToDelete.name) { - el.style.backgroundColor = 'transparent' + const element = el as HTMLElement + if (element.dataset.name === notesToDelete.name) { + element.style.backgroundColor = 'transparent' } }) }, @@ -179,16 +181,16 @@ const createNote = () => { member: user?.data?.name, note: `

${selectedText.value}


`, color: 'Yellow', + name: '', }, { onSuccess(data: Note) { - selectedText.value = '' - resetStates() + emit('updateNotes') setTimeout(() => { scrollToText(selectedText.value) blockQuotesClick() - }, 0) - emit('updateNotes') + resetStates() + }, 100) }, onError(err: any) { console.error('Error creating note:', err) @@ -206,11 +208,12 @@ const updateNote = (noteToUpdate: Note) => { }, { onSuccess(data: Note) { - resetStates() + emit('updateNotes') setTimeout(() => { scrollToText(selectedText.value) blockQuotesClick() - }, 0) + resetStates() + }, 100) }, onError(err: any) { console.error('Error updating note:', err) @@ -222,9 +225,10 @@ const updateNote = (noteToUpdate: Note) => { const scrollToText = (text: string) => { const elements = document.querySelectorAll('blockquote p') - Array.from(elements).forEach((el: HTMLElement) => { - if (el.textContent?.toLowerCase().includes(text.toLowerCase())) { - el.scrollIntoView({ behavior: 'smooth', block: 'center' }) + Array.from(elements).forEach((el) => { + const element = el as HTMLElement + if (element.textContent?.toLowerCase().includes(text.toLowerCase())) { + element.scrollIntoView({ behavior: 'smooth', block: 'center' }) } }) } @@ -233,6 +237,5 @@ const resetStates = () => { selectedText.value = '' show.value = false resetMenuPosition() - emit('updateNotes') } diff --git a/frontend/src/components/Notes/Notes.vue b/frontend/src/components/Notes/Notes.vue index 2983bc4f..f390f8af 100644 --- a/frontend/src/components/Notes/Notes.vue +++ b/frontend/src/components/Notes/Notes.vue @@ -5,7 +5,7 @@ @@ -33,10 +33,13 @@ onMounted(() => { updateCurrentNote() }) -watch(notes.value, () => { - updateCurrentNote() - blockQuotesClick() -}) +watch( + () => notes.value?.data, + () => { + updateCurrentNote() + blockQuotesClick() + } +) const updateCurrentNote = () => { const currentNote = notes.value?.data?.filter((row: Note) => { @@ -46,9 +49,10 @@ const updateCurrentNote = () => { note.value = null currentNoteName.value = null return + } else if (currentNote && currentNote.length > 0) { + currentNoteName.value = currentNote[0].name + note.value = currentNote[0].note || null } - currentNoteName.value = currentNote[0].name - note.value = currentNote[0].note } const updateNoteText = (val: string) => { @@ -75,6 +79,7 @@ const createNote = () => { member: user?.data?.name, note: note.value, color: 'Yellow', + name: '', }, { onSuccess(data: Note) { @@ -89,6 +94,7 @@ const createNote = () => { } const updateNote = () => { + if (!currentNoteName.value) return notes.value?.setValue.submit( { name: currentNoteName.value, diff --git a/frontend/src/components/Notes/types.ts b/frontend/src/components/Notes/types.ts index 6364a506..06182f39 100644 --- a/frontend/src/components/Notes/types.ts +++ b/frontend/src/components/Notes/types.ts @@ -2,7 +2,7 @@ export type Note = { highlighted_text?: string color?: string - name?: string + name: string note?: string | null lesson?: string member?: string diff --git a/frontend/src/pages/Lesson.vue b/frontend/src/pages/Lesson.vue index 553bb3e9..2c48a92c 100644 --- a/frontend/src/pages/Lesson.vue +++ b/frontend/src/pages/Lesson.vue @@ -232,6 +232,7 @@ v-if="currentTab === 'Notes'" :lesson="lesson.data?.name" v-model:notes="notes" + @updateNotes="updateNotes" />
-