diff --git a/components/carnet/notes-view.tsx b/components/carnet/notes-view.tsx index d9f78c67..de00f07c 100644 --- a/components/carnet/notes-view.tsx +++ b/components/carnet/notes-view.tsx @@ -92,19 +92,19 @@ export const NotesView: React.FC = ({ onNoteSelect, currentFolde }; const sortNotes = (notes: Note[]) => { - if (currentFolder === 'Diary' || currentFolder === 'Health') { - return [...notes].sort((a, b) => { - // Try to extract dates from titles + return [...notes].sort((a, b) => { + if (currentFolder === 'Diary' || currentFolder === 'Health') { + // For Diary and Health, sort by date in title first const dateA = a.title.match(/^(\d{4}-\d{2}-\d{2})/); const dateB = b.title.match(/^(\d{4}-\d{2}-\d{2})/); if (dateA && dateB) { return new Date(dateB[1]).getTime() - new Date(dateA[1]).getTime(); } - return 0; - }); - } - return notes; + } + // For all folders, sort by lastModified date + return new Date(b.lastModified).getTime() - new Date(a.lastModified).getTime(); + }); }; const Icon = getFolderIcon(currentFolder); @@ -164,12 +164,22 @@ export const NotesView: React.FC = ({ onNoteSelect, currentFolde
-
- {formatNoteTitle(note)} -
-
- {formatDate(note.lastModified)} -
+ {currentFolder === 'Diary' || currentFolder === 'Health' ? ( + <> +
+ {formatNoteTitle(note)} +
+ + ) : ( + <> +
+ {note.title} +
+
+ {formatDate(note.lastModified)} +
+ + )}
@@ -177,6 +187,17 @@ export const NotesView: React.FC = ({ onNoteSelect, currentFolde )} + + {/* New Note Button */} +
+ +
); }; \ No newline at end of file