From 5c413d466b8a42524f0bc178cb08eb49f3456f59 Mon Sep 17 00:00:00 2001 From: Maximilian Harz Date: Thu, 5 Jun 2025 19:46:58 +0200 Subject: [PATCH] Add dialog for delete confirmation --- .../Profile/Subcomponents/GalleryForm.tsx | 95 +++++++++++++------ 1 file changed, 64 insertions(+), 31 deletions(-) diff --git a/src/Components/Profile/Subcomponents/GalleryForm.tsx b/src/Components/Profile/Subcomponents/GalleryForm.tsx index ad5a3ae8..db2b4151 100644 --- a/src/Components/Profile/Subcomponents/GalleryForm.tsx +++ b/src/Components/Profile/Subcomponents/GalleryForm.tsx @@ -5,6 +5,7 @@ import { useState } from 'react' import { useDropzone } from 'react-dropzone' import { useAppState } from '#components/AppShell/hooks/useAppState' +import DialogModal from '#components/Templates/DialogModal' import type { FormState } from '#types/FormState' @@ -24,6 +25,10 @@ export const GalleryForm = ({ state, setState }: Props) => { const [uploadingImages, setUploadingImages] = useState([]) + const [deleteModalImage, setDeleteModalImage] = useState(null) + + const closeModal = () => setDeleteModalImage(null) + const upload = async (acceptedFiles: File[]) => { setUploadingImages((files) => [...files, ...acceptedFiles]) @@ -82,38 +87,66 @@ export const GalleryForm = ({ state, setState }: Props) => { } return ( -
- {images.map((image, index) => ( -
- {`Gallery - {image.state === 'uploading' && ( - - )} - {image.state === 'uploaded' && ( - - )} -
- ))} + <> +
+ {images.map((image, index) => ( +
+ {`Gallery + {image.state === 'uploading' && ( + + )} + {image.state === 'uploaded' && ( + + )} +
+ ))} -
- - +
+ + +
-
+ +
e.stopPropagation()}> + Do you want to delete this image? +
+
+ + +
+
+
+
+ ) }