44 :style =" { '--opacity': id && note ? 1 : 0 }"
55 >
66 <template #left >
7- {{
8- note && 'updatedAt' in note && note.updatedAt
9- ? t('note.lastEdit') + ' ' + getTimeFromNow(note.updatedAt)
10- : t('note.lastEdit') + ' ' + 'a few seconds ago'
11- }}
7+ <BreadCrumbs
8+ :note-parents =" noteParents"
9+ />
1210 </template >
1311 <template #right >
12+ <div class =" last_edit" >
13+ {{
14+ note && 'updatedAt' in note && note.updatedAt
15+ ? t('note.lastEdit') + ' ' + getTimeFromNow(note.updatedAt)
16+ : t('note.lastEdit') + ' ' + 'a few seconds ago'
17+ }}
18+ </div >
1419 <Button
1520 v-if =" canEdit"
1621 secondary
5964
6065<script lang="ts" setup>
6166import { computed , ref , toRef , watch } from ' vue' ;
62- import { Button , Editor , type VerticalMenuItem , VerticalMenu , PageBlock } from ' @codexteam/ui/vue' ;
67+ import { Button , Editor , PageBlock , VerticalMenu , type VerticalMenuItem } from ' @codexteam/ui/vue' ;
6368import useNote from ' @/application/services/useNote' ;
6469import { useRoute , useRouter } from ' vue-router' ;
6570import { NoteContent } from ' @/domain/entities/Note' ;
6671import { useHead } from ' unhead' ;
6772import { useI18n } from ' vue-i18n' ;
68- import { getTimeFromNow } from ' @/infrastructure/utils/date' ;
6973import { makeElementScreenshot } from ' @/infrastructure/utils/screenshot' ;
7074import useNoteSettings from ' @/application/services/useNoteSettings' ;
7175import { useNoteEditor } from ' @/application/services/useNoteEditor' ;
7276import NoteHeader from ' @/presentation/components/note-header/NoteHeader.vue' ;
77+ import BreadCrumbs from ' @/presentation/components/breadcrumbs/BreadCrumbs.vue' ;
7378import { NoteHierarchy } from ' @/domain/entities/NoteHierarchy' ;
7479import { getTitle } from ' @/infrastructure/utils/note' ;
80+ import { getTimeFromNow } from ' @/infrastructure/utils/date.ts' ;
7581
7682const { t } = useI18n ();
7783
@@ -93,7 +99,7 @@ const props = defineProps<{
9399
94100const noteId = toRef (props , ' id' );
95101
96- const { note, noteTools, save, noteTitle, canEdit, noteHierarchy } = useNote ({
102+ const { note, noteTools, save, noteTitle, canEdit, noteParents, noteHierarchy } = useNote ({
97103 id: noteId ,
98104});
99105
@@ -164,7 +170,7 @@ async function noteChanged(data: NoteContent): Promise<void> {
164170 });
165171 }
166172 if (updatedNoteCover !== null && props .id !== null ) {
167- updateCover (props .id , updatedNoteCover );
173+ await updateCover (props .id , updatedNoteCover );
168174 }
169175 }
170176}
@@ -173,6 +179,7 @@ async function noteChanged(data: NoteContent): Promise<void> {
173179 * Recursively transform the note hierarchy into a VerticalMenuItem
174180 *
175181 * @param noteHierarchyObj - note hierarchy data
182+ * @param currentNoteTitle - actual title of note
176183 * @returns menuItem - VerticalMenuItem
177184 */
178185
@@ -186,17 +193,16 @@ function transformNoteHierarchy(noteHierarchyObj: NoteHierarchy | null, currentN
186193 }
187194
188195 const title = noteHierarchyObj .content ? getTitle (noteHierarchyObj .content ) : ' Untitled' ;
196+
189197 // Transform the current note into a VerticalMenuItem
190- const menuItem : VerticalMenuItem = {
198+ return {
191199 title: title ,
192200 isActive: route .path === ` /note/${noteHierarchyObj .id } ` ,
193201 items: noteHierarchyObj .childNotes ? noteHierarchyObj .childNotes .map (child => transformNoteHierarchy (child , currentNoteTitle )) : undefined ,
194202 onActivate : () => {
195203 void router .push (` /note/${noteHierarchyObj .id } ` );
196204 },
197205 };
198-
199- return menuItem ;
200206}
201207
202208const verticalMenuItems = computed <VerticalMenuItem >(() => {
@@ -232,4 +238,9 @@ watch(noteTitle, () => {
232238 height : fit-content ;
233239 width : auto ;
234240}
241+
242+ .last_edit {
243+ color : var (--base--text-secondary );
244+ padding-right : var (--h-padding );
245+ }
235246 </style >
0 commit comments