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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user