carnet panel dairy health
This commit is contained in:
parent
26fe0433e7
commit
502316804f
@ -92,19 +92,19 @@ export const NotesView: React.FC<NotesViewProps> = ({ 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<NotesViewProps> = ({ onNoteSelect, currentFolde
|
||||
<div className="flex items-center space-x-2">
|
||||
<Icon className="h-4 w-4 text-carnet-text-muted" />
|
||||
<div className="flex-1">
|
||||
<div className="text-sm font-medium text-carnet-text-primary">
|
||||
{formatNoteTitle(note)}
|
||||
</div>
|
||||
<div className="text-xs text-carnet-text-muted">
|
||||
{formatDate(note.lastModified)}
|
||||
</div>
|
||||
{currentFolder === 'Diary' || currentFolder === 'Health' ? (
|
||||
<>
|
||||
<div className="text-sm font-medium text-carnet-text-primary">
|
||||
{formatNoteTitle(note)}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="text-sm font-medium text-carnet-text-primary">
|
||||
{note.title}
|
||||
</div>
|
||||
<div className="text-xs text-carnet-text-muted">
|
||||
{formatDate(note.lastModified)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@ -177,6 +187,17 @@ export const NotesView: React.FC<NotesViewProps> = ({ onNoteSelect, currentFolde
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* New Note Button */}
|
||||
<div className="p-4 border-t border-carnet-border">
|
||||
<button
|
||||
onClick={handleNewNote}
|
||||
className="w-full flex items-center justify-center space-x-2 px-4 py-2 bg-primary text-white rounded-md hover:bg-primary-dark"
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
<span>Nouvelle note</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user