From 29028325a7fd04c048b62d8e7bd1fef4df718f02 Mon Sep 17 00:00:00 2001 From: alma Date: Sun, 20 Apr 2025 18:35:13 +0200 Subject: [PATCH] carnet panel --- components/carnet/editor.tsx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/components/carnet/editor.tsx b/components/carnet/editor.tsx index 6046ad67..8f10c578 100644 --- a/components/carnet/editor.tsx +++ b/components/carnet/editor.tsx @@ -1,7 +1,7 @@ "use client"; import React, { useState, useEffect } from 'react'; -import { Image, FileText, Link, List } from 'lucide-react'; +import { Image, FileText, Link, List, Plus } from 'lucide-react'; interface Note { id: string; @@ -46,7 +46,11 @@ export const Editor: React.FC = ({ note, onSave, currentFolder = 'N if (note) { setTitle(note.title); - fetchNoteContent(); + if (note.id) { + fetchNoteContent(); + } else { + setContent(''); + } } else { setTitle(''); setContent(''); @@ -99,6 +103,22 @@ export const Editor: React.FC = ({ note, onSave, currentFolder = 'N } }; + if (!note) { + return ( +
+
+ +

+ Sélectionnez une note +

+

+ Choisissez une note existante ou créez-en une nouvelle +

+
+
+ ); + } + return (
{/* Title Bar */}