carnet panel2
This commit is contained in:
parent
b9f10c8a57
commit
8bef7bac16
@ -8,10 +8,11 @@ import { fr } from 'date-fns/locale';
|
||||
interface Note {
|
||||
id: string;
|
||||
title: string;
|
||||
content: string;
|
||||
lastEdited: Date;
|
||||
category?: string;
|
||||
tags?: string[];
|
||||
lastModified: string;
|
||||
size: number;
|
||||
type: string;
|
||||
mime: string;
|
||||
etag: string;
|
||||
}
|
||||
|
||||
interface NotesViewProps {
|
||||
@ -33,7 +34,7 @@ export const NotesView: React.FC<NotesViewProps> = ({ onNoteSelect, currentFolde
|
||||
throw new Error('Failed to fetch notes');
|
||||
}
|
||||
const data = await response.json();
|
||||
setNotes(data.files || []);
|
||||
setNotes(data);
|
||||
} catch (err) {
|
||||
console.error('Error fetching notes:', err);
|
||||
setNotes([]);
|
||||
@ -49,15 +50,18 @@ export const NotesView: React.FC<NotesViewProps> = ({ onNoteSelect, currentFolde
|
||||
const newNote: Note = {
|
||||
id: Date.now().toString(),
|
||||
title: 'New Note',
|
||||
content: '',
|
||||
lastEdited: new Date()
|
||||
lastModified: new Date().toISOString(),
|
||||
size: 0,
|
||||
type: 'file',
|
||||
mime: 'text/markdown',
|
||||
etag: ''
|
||||
};
|
||||
setNotes([newNote, ...notes]);
|
||||
onNoteSelect?.(newNote);
|
||||
};
|
||||
|
||||
const formatDate = (date: Date) => {
|
||||
return format(date, 'EEEE d MMM yyyy, HH:mm', { locale: fr });
|
||||
const formatDate = (dateString: string) => {
|
||||
return format(new Date(dateString), 'EEEE d MMM yyyy, HH:mm', { locale: fr });
|
||||
};
|
||||
|
||||
const getFolderIcon = (folder: string) => {
|
||||
@ -137,23 +141,11 @@ export const NotesView: React.FC<NotesViewProps> = ({ onNoteSelect, currentFolde
|
||||
<span className="text-sm font-medium text-carnet-text-primary">
|
||||
{note.title}
|
||||
</span>
|
||||
{note.tags?.map((tag) => (
|
||||
<span
|
||||
key={tag}
|
||||
className="ml-2 px-1.5 py-0.5 bg-carnet-tag-finance-bg rounded text-xs font-medium text-carnet-tag-finance-text"
|
||||
>
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<div className="mt-1 flex items-center text-xs text-carnet-text-muted">
|
||||
<span>{formatDate(note.lastEdited)}</span>
|
||||
{note.content && (
|
||||
<>
|
||||
<span className="mx-1.5">•</span>
|
||||
<span>{note.content}</span>
|
||||
</>
|
||||
)}
|
||||
<span>{formatDate(note.lastModified)}</span>
|
||||
<span className="mx-1.5">•</span>
|
||||
<span>{note.size} bytes</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user