From 2b0ea1f57f4dcc48d18475216c3b2de7d324c89a Mon Sep 17 00:00:00 2001 From: devnull-1337 Date: Sun, 6 Apr 2025 15:27:19 +0530 Subject: [PATCH 1/7] Note heirarchy changes --- src/domain/entities/NoteHierarchy.ts | 8 ++++---- src/presentation/pages/Note.vue | 8 +++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/domain/entities/NoteHierarchy.ts b/src/domain/entities/NoteHierarchy.ts index b7aff805..9fc178c6 100644 --- a/src/domain/entities/NoteHierarchy.ts +++ b/src/domain/entities/NoteHierarchy.ts @@ -1,4 +1,4 @@ -import { type NoteContent, type NoteId } from './Note'; +import { type NoteId } from './Note'; /** * Note Tree entity @@ -8,12 +8,12 @@ export interface NoteHierarchy { /** * public note id */ - id: NoteId; + noteId: NoteId; /** - * note content + * note title */ - content: NoteContent | null; + noteTitle: string; /** * child notes diff --git a/src/presentation/pages/Note.vue b/src/presentation/pages/Note.vue index 31ec39f0..5a728954 100644 --- a/src/presentation/pages/Note.vue +++ b/src/presentation/pages/Note.vue @@ -71,7 +71,6 @@ import useNoteSettings from '@/application/services/useNoteSettings'; import { useNoteEditor } from '@/application/services/useNoteEditor'; import NoteHeader from '@/presentation/components/note-header/NoteHeader.vue'; import { NoteHierarchy } from '@/domain/entities/NoteHierarchy'; -import { getTitle } from '@/infrastructure/utils/note'; const { t } = useI18n(); @@ -185,14 +184,13 @@ function transformNoteHierarchy(noteHierarchyObj: NoteHierarchy | null, currentN }; } - const title = noteHierarchyObj.content ? getTitle(noteHierarchyObj.content) : 'Untitled'; // Transform the current note into a VerticalMenuItem const menuItem: VerticalMenuItem = { - title: title, - isActive: route.path === `/note/${noteHierarchyObj.id}`, + title: noteHierarchyObj?.noteTitle || 'Untitled', + isActive: route.path === `/note/${noteHierarchyObj.noteId}`, items: noteHierarchyObj.childNotes ? noteHierarchyObj.childNotes.map(child => transformNoteHierarchy(child, currentNoteTitle)) : undefined, onActivate: () => { - void router.push(`/note/${noteHierarchyObj.id}`); + void router.push(`/note/${noteHierarchyObj.noteId}`); }, }; From d3016b56d101671eff857aafd630bfb5fa5650a2 Mon Sep 17 00:00:00 2001 From: devnull-1337 Date: Mon, 7 Apr 2025 09:19:39 +0530 Subject: [PATCH 2/7] Note title fix --- src/application/services/useNote.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/application/services/useNote.ts b/src/application/services/useNote.ts index 3f36a4a2..9f447164 100644 --- a/src/application/services/useNote.ts +++ b/src/application/services/useNote.ts @@ -328,29 +328,29 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt } /** - * Recursively update the note hierarchy content + * Recursively update the note hierarchy title * @param hierarchy - The note hierarchy to update - * @param content - The new content to update in the hierarchy + * @param title - The new title to update in the hierarchy */ - function updateNoteHierarchyContent(hierarchy: NoteHierarchy | null, content: NoteContent | null): void { + function updateNoteHierarchyContent(hierarchy: NoteHierarchy | null, title: string): void { // If hierarchy is null, there's nothing to update if (!hierarchy) { return; } // If content is null, we can't update the hierarchy content - if (!content) { + if (!title) { return; } - // Update the content of the current note in the hierarchy if it matches the currentId - if (hierarchy.id === currentId.value) { - hierarchy.content = content; + // Update the title of the current note in the hierarchy if it matches the currentId + if (hierarchy.noteId === currentId.value) { + hierarchy.noteTitle = title; } // Recursively update child notes if (hierarchy.childNotes) { - hierarchy.childNotes.forEach(child => updateNoteHierarchyContent(child, content)); + hierarchy.childNotes.forEach(child => updateNoteHierarchyContent(child, title)); } } @@ -386,7 +386,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt url: route.path, }); - updateNoteHierarchyContent(noteHierarchy.value, lastUpdateContent.value); + updateNoteHierarchyContent(noteHierarchy.value, currentNoteTitle); }); return { From 4952a70d3d26b591c38db88ecc633951a20db7b3 Mon Sep 17 00:00:00 2001 From: devnull-1337 Date: Mon, 14 Apr 2025 23:49:28 +0530 Subject: [PATCH 3/7] Bug check --- src/application/services/useNote.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/application/services/useNote.ts b/src/application/services/useNote.ts index 64ba00fc..5aabcc0d 100644 --- a/src/application/services/useNote.ts +++ b/src/application/services/useNote.ts @@ -386,9 +386,8 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt title: currentNoteTitle, url: route.path, }); - - updateNoteHierarchyContent(noteHierarchy.value, currentNoteTitle); } + updateNoteHierarchyContent(noteHierarchy.value, currentNoteTitle); }); return { From 7fc7781f0a00656add5a155da96ed51ada89a2c7 Mon Sep 17 00:00:00 2001 From: devnull-1337 Date: Tue, 15 Apr 2025 00:15:56 +0530 Subject: [PATCH 4/7] Todo added --- src/presentation/components/app-navbar/AppNavbar.vue | 3 +++ src/presentation/pages/Note.vue | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/presentation/components/app-navbar/AppNavbar.vue b/src/presentation/components/app-navbar/AppNavbar.vue index f1943353..8f407dba 100644 --- a/src/presentation/components/app-navbar/AppNavbar.vue +++ b/src/presentation/components/app-navbar/AppNavbar.vue @@ -43,6 +43,9 @@ const { showGoogleAuthPopup } = useAuth(); const { currentOpenedPages, deleteOpenedPageByUrl } = useNavbar(); +/** + * @todo when user clicks on + button to add new note the user should see the previous note heirarchy + */ const tabs = computed(() => currentOpenedPages.value.map((page): TabParams => { return { id: page.url, diff --git a/src/presentation/pages/Note.vue b/src/presentation/pages/Note.vue index 5a728954..855efe52 100644 --- a/src/presentation/pages/Note.vue +++ b/src/presentation/pages/Note.vue @@ -168,6 +168,9 @@ async function noteChanged(data: NoteContent): Promise { } } +/** + * @todo when user clicks on + button to add new note the user should see the previous note heirarchy + */ /** * Recursively transform the note hierarchy into a VerticalMenuItem * From ac7c797d03e149f6be0e0db102f029d2f12e9f5b Mon Sep 17 00:00:00 2001 From: devnull-1337 Date: Tue, 15 Apr 2025 01:12:49 +0530 Subject: [PATCH 5/7] Todo added on the code block --- src/presentation/pages/Note.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/presentation/pages/Note.vue b/src/presentation/pages/Note.vue index 855efe52..9ace7507 100644 --- a/src/presentation/pages/Note.vue +++ b/src/presentation/pages/Note.vue @@ -168,9 +168,6 @@ async function noteChanged(data: NoteContent): Promise { } } -/** - * @todo when user clicks on + button to add new note the user should see the previous note heirarchy - */ /** * Recursively transform the note hierarchy into a VerticalMenuItem * @@ -189,6 +186,9 @@ function transformNoteHierarchy(noteHierarchyObj: NoteHierarchy | null, currentN // Transform the current note into a VerticalMenuItem const menuItem: VerticalMenuItem = { + /** + * @todo when user clicks on + button to add new note the user should see the previous note heirarchy + */ title: noteHierarchyObj?.noteTitle || 'Untitled', isActive: route.path === `/note/${noteHierarchyObj.noteId}`, items: noteHierarchyObj.childNotes ? noteHierarchyObj.childNotes.map(child => transformNoteHierarchy(child, currentNoteTitle)) : undefined, From f83d60fd7a86dc80506652ca9a8cb7215d248f97 Mon Sep 17 00:00:00 2001 From: devnull-1337 Date: Mon, 28 Apr 2025 23:52:08 +0530 Subject: [PATCH 6/7] Changed the Todo to the plus button --- src/presentation/pages/Note.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/presentation/pages/Note.vue b/src/presentation/pages/Note.vue index 9ace7507..a98fd33f 100644 --- a/src/presentation/pages/Note.vue +++ b/src/presentation/pages/Note.vue @@ -11,6 +11,7 @@ }}