From 9e08bd08f667e27ea15473957afb53339eeb44ec Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Wed, 6 Nov 2024 18:55:38 +0600 Subject: [PATCH] feat: delete confimation --- src/components/CourseNotes/CourseNoteForm.tsx | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/components/CourseNotes/CourseNoteForm.tsx b/src/components/CourseNotes/CourseNoteForm.tsx index 77b75915b..237f2df14 100644 --- a/src/components/CourseNotes/CourseNoteForm.tsx +++ b/src/components/CourseNotes/CourseNoteForm.tsx @@ -25,7 +25,9 @@ export function CourseNoteForm(props: CourseNoteFormProps) { currentLessonId, } = props; + const [isDeleting, setIsDeleting] = useState(false); const [content, setContent] = useState(defaultNote?.content || ''); + const upsertNote = useUpsertCourseNoteMutation(courseId); const deleteNote = useDeleteCourseNoteMutation(courseId); @@ -40,21 +42,45 @@ export function CourseNoteForm(props: CourseNoteFormProps) { Cancel
- {defaultNote?._id && ( + {defaultNote?._id && !isDeleting && ( )} + + {defaultNote?._id && isDeleting && ( +

+ Are you sure?{' '} + {' '} + /{' '} + +

+ )} +