From 73afba37ac85ddde4cfd372d6229eeb54dd7956b Mon Sep 17 00:00:00 2001 From: valentinkolb Date: Mon, 17 Jun 2024 20:22:49 +0200 Subject: [PATCH] fix(announcements): improved sending flow --- src/components/ConfirmModal.tsx | 14 ++----- src/components/formUtil/FormFilter/index.tsx | 19 ++++++++- src/pages/chat/components/Announcements.tsx | 2 +- .../EventLists/Search/MessageEntriesModal.tsx | 1 + .../e/:eventId/EventLists/Search/index.tsx | 41 +++++++++++-------- 5 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/components/ConfirmModal.tsx b/src/components/ConfirmModal.tsx index 535027c..2b18db6 100644 --- a/src/components/ConfirmModal.tsx +++ b/src/components/ConfirmModal.tsx @@ -1,7 +1,6 @@ import {Button, Group, Modal, ModalProps, Text} from "@mantine/core"; import {useDisclosure} from "@mantine/hooks"; import {IconAlertTriangle} from "@tabler/icons-react"; -import {useState} from "react"; /** @@ -13,19 +12,17 @@ import {useState} from "react"; * @param onCancel - the function to call when the user cancels (optional) * @param props - additional props for the modal */ -export const useConfirmModal = ( +export const useConfirmModal = ( {title, description, onConfirm, onCancel, ...props}: { title?: string, description: string, - onConfirm: (t?: T) => void, + onConfirm: () => void, onCancel?: () => void } & Omit ) => { const [showConfirmModal, handler] = useDisclosure(false) - const [data, setData] = useState(undefined) - const ConfirmModal = () => { return <> ( onClick={() => { handler.close() onCancel?.() - setData(undefined) }}> Abbrechen