Add favorite notes sorting to display starred notes at top

- Favorited/starred notes now appear at the top of the notes list
- Within each group (favorites/non-favorites), notes are sorted by modified date (newest first)
- Matches mobile app behavior
This commit is contained in:
drelich
2026-03-31 10:06:02 +02:00
parent 12b50c2304
commit 21cd9ced2f

View File

@@ -315,6 +315,12 @@ function App() {
note.content.toLowerCase().includes(search); note.content.toLowerCase().includes(search);
} }
return true; return true;
}).sort((a, b) => {
// Sort favorites first, then by modified date (newest first)
if (a.favorite !== b.favorite) {
return a.favorite ? -1 : 1;
}
return b.modified - a.modified;
}); });
const selectedNote = notes.find(n => n.id === selectedNoteId) || null; const selectedNote = notes.find(n => n.id === selectedNoteId) || null;