carnet panel
This commit is contained in:
parent
e1b96ec79f
commit
970908d605
@ -34,6 +34,7 @@ export const NotesView: React.FC<NotesViewProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
const [hoveredNote, setHoveredNote] = useState<string | null>(null);
|
const [hoveredNote, setHoveredNote] = useState<string | null>(null);
|
||||||
|
const [noteToDelete, setNoteToDelete] = useState<Note | null>(null);
|
||||||
|
|
||||||
const formatDate = (dateString: string) => {
|
const formatDate = (dateString: string) => {
|
||||||
return format(new Date(dateString), 'EEEE d MMM yyyy', { locale: fr });
|
return format(new Date(dateString), 'EEEE d MMM yyyy', { locale: fr });
|
||||||
@ -86,6 +87,37 @@ export const NotesView: React.FC<NotesViewProps> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full bg-carnet-bg border-r border-carnet-border">
|
<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 */}
|
{/* Header with New Note Button */}
|
||||||
<div className="p-4 border-b border-carnet-border">
|
<div className="p-4 border-b border-carnet-border">
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
@ -164,7 +196,7 @@ export const NotesView: React.FC<NotesViewProps> = ({
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
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"
|
className="p-1 text-carnet-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity"
|
||||||
>
|
>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user