carnet panel

This commit is contained in:
alma 2025-04-20 18:55:52 +02:00
parent e1b96ec79f
commit 970908d605

View File

@ -34,6 +34,7 @@ export const NotesView: React.FC<NotesViewProps> = ({
}) => {
const [searchQuery, setSearchQuery] = useState('');
const [hoveredNote, setHoveredNote] = useState<string | null>(null);
const [noteToDelete, setNoteToDelete] = useState<Note | null>(null);
const formatDate = (dateString: string) => {
return format(new Date(dateString), 'EEEE d MMM yyyy', { locale: fr });
@ -86,6 +87,37 @@ export const NotesView: React.FC<NotesViewProps> = ({
return (
<div className="flex flex-col h-full bg-carnet-bg border-r border-carnet-border">
{/* Confirmation Dialog */}
{noteToDelete && (
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
<div className="bg-carnet-bg p-6 rounded-lg shadow-lg max-w-md w-full">
<h3 className="text-lg font-semibold text-carnet-text-primary mb-4">
Supprimer la note
</h3>
<p className="text-carnet-text-muted mb-6">
Êtes-vous sûr de vouloir supprimer la note "{noteToDelete.title}" ? Cette action est irréversible.
</p>
<div className="flex justify-end space-x-4">
<button
onClick={() => setNoteToDelete(null)}
className="px-4 py-2 text-carnet-text-primary hover:bg-carnet-hover rounded-md"
>
Annuler
</button>
<button
onClick={() => {
onDeleteNote?.(noteToDelete);
setNoteToDelete(null);
}}
className="px-4 py-2 bg-red-500 text-white hover:bg-red-600 rounded-md"
>
Supprimer
</button>
</div>
</div>
</div>
)}
{/* Header with New Note Button */}
<div className="p-4 border-b border-carnet-border">
<div className="flex items-center justify-between mb-4">
@ -164,7 +196,7 @@ export const NotesView: React.FC<NotesViewProps> = ({
<button
onClick={(e) => {
e.stopPropagation();
onDeleteNote?.(note);
setNoteToDelete(note);
}}
className="p-1 text-carnet-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity"
>