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