Make admin modals non-dismissible with confirmation
Prevent accidental data loss by requiring confirmation before closing any admin modal via backdrop click. Applied to all admin pages with dialogs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -580,7 +580,13 @@ export default function AdminConsulting() {
|
||||
</Tabs>
|
||||
|
||||
{/* Meet Link Dialog */}
|
||||
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
<Dialog open={dialogOpen} onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
const confirmed = window.confirm('Tutup dialog? Data yang belum disimpan akan hilang.');
|
||||
if (!confirmed) return;
|
||||
}
|
||||
setDialogOpen(open);
|
||||
}}>
|
||||
<DialogContent className="max-w-md border-2 border-border">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Link Google Meet</DialogTitle>
|
||||
|
||||
@@ -432,7 +432,13 @@ export default function AdminEvents() {
|
||||
</Tabs>
|
||||
|
||||
{/* Event Dialog */}
|
||||
<Dialog open={eventDialogOpen} onOpenChange={setEventDialogOpen}>
|
||||
<Dialog open={eventDialogOpen} onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
const confirmed = window.confirm('Tutup dialog? Data yang belum disimpan akan hilang.');
|
||||
if (!confirmed) return;
|
||||
}
|
||||
setEventDialogOpen(open);
|
||||
}}>
|
||||
<DialogContent className="max-w-md border-2 border-border">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{editingEvent ? 'Edit Event' : 'Buat Event Baru'}</DialogTitle>
|
||||
@@ -504,7 +510,13 @@ export default function AdminEvents() {
|
||||
</Dialog>
|
||||
|
||||
{/* Block Dialog */}
|
||||
<Dialog open={blockDialogOpen} onOpenChange={setBlockDialogOpen}>
|
||||
<Dialog open={blockDialogOpen} onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
const confirmed = window.confirm('Tutup dialog? Data yang belum disimpan akan hilang.');
|
||||
if (!confirmed) return;
|
||||
}
|
||||
setBlockDialogOpen(open);
|
||||
}}>
|
||||
<DialogContent className="max-w-md border-2 border-border">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{editingBlock ? 'Edit Blok' : 'Tambah Blok Ketersediaan'}</DialogTitle>
|
||||
|
||||
@@ -205,7 +205,13 @@ export default function AdminMembers() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
<Dialog open={dialogOpen} onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
const confirmed = window.confirm('Tutup dialog? Data yang belum disimpan akan hilang.');
|
||||
if (!confirmed) return;
|
||||
}
|
||||
setDialogOpen(open);
|
||||
}}>
|
||||
<DialogContent className="max-w-lg border-2 border-border">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Detail Member</DialogTitle>
|
||||
|
||||
@@ -262,7 +262,13 @@ export default function AdminOrders() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
<Dialog open={dialogOpen} onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
const confirmed = window.confirm('Tutup dialog? Data yang belum disimpan akan hilang.');
|
||||
if (!confirmed) return;
|
||||
}
|
||||
setDialogOpen(open);
|
||||
}}>
|
||||
<DialogContent className="max-w-lg border-2 border-border">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Detail Order</DialogTitle>
|
||||
|
||||
@@ -267,7 +267,13 @@ export default function AdminProducts() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
<Dialog open={dialogOpen} onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
const confirmed = window.confirm('Tutup dialog? Data yang belum disimpan akan hilang.');
|
||||
if (!confirmed) return;
|
||||
}
|
||||
setDialogOpen(open);
|
||||
}}>
|
||||
<DialogContent className="max-w-3xl max-h-[90vh] overflow-y-auto border-2 border-border">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{editingProduct ? 'Edit Produk' : 'Produk Baru'}</DialogTitle>
|
||||
|
||||
Reference in New Issue
Block a user