Prevent closing dialog when announcements are selected in AddAnnuncio component

This commit is contained in:
Marco Pedone 2025-08-19 16:47:12 +02:00
parent 63d2fbd8ad
commit 6124ba0271

View file

@ -121,7 +121,14 @@ export const AddAnnuncio = ({
Annuncio
</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogContent
className="sm:max-w-[425px]"
onInteractOutside={(e) => {
if (selectedAnnunci.length !== 0) {
e.preventDefault(); // Prevent closing the dialog if there are selected announcements
}
}}
>
<DialogHeader>
<DialogTitle>Aggiungi annuncio</DialogTitle>
<DialogDescription>