Prevent dismissing active imports

This commit is contained in:
Gregory Schier
2026-08-16 23:08:11 -07:00
parent 7d83b5cf3a
commit c14f6ff3bb
2 changed files with 10 additions and 4 deletions
+9 -3
View File
@@ -10,6 +10,7 @@ export interface DialogProps {
children: ReactNode; children: ReactNode;
open: boolean; open: boolean;
onClose?: () => void; onClose?: () => void;
disableClose?: boolean;
disableBackdropClose?: boolean; disableBackdropClose?: boolean;
title?: ReactNode; title?: ReactNode;
description?: ReactNode; description?: ReactNode;
@@ -27,6 +28,7 @@ export function Dialog({
size = "full", size = "full",
open, open,
onClose, onClose,
disableClose,
disableBackdropClose, disableBackdropClose,
title, title,
description, description,
@@ -42,7 +44,11 @@ export function Dialog({
); );
return ( return (
<Overlay open={open} onClose={disableBackdropClose ? undefined : onClose} portalName="dialog"> <Overlay
open={open}
onClose={disableClose || disableBackdropClose ? undefined : onClose}
portalName="dialog"
>
<div <div
role="dialog" role="dialog"
className={classNames( className={classNames(
@@ -58,7 +64,7 @@ export function Dialog({
// NOTE: We handle Escape on the element itself so that it doesn't close multiple // NOTE: We handle Escape on the element itself so that it doesn't close multiple
// dialogs and can be intercepted by children if needed. // dialogs and can be intercepted by children if needed.
if (e.key === "Escape") { if (e.key === "Escape") {
onClose?.(); if (!disableClose) onClose?.();
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
} }
@@ -110,7 +116,7 @@ export function Dialog({
</div> </div>
{/*Put close at the end so that it's the last thing to be tabbed to*/} {/*Put close at the end so that it's the last thing to be tabbed to*/}
{!hideX && ( {!hideX && !disableClose && (
<div className="ml-auto absolute right-1 top-1"> <div className="ml-auto absolute right-1 top-1">
<IconButton <IconButton
className="opacity-70 hover:opacity-100" className="opacity-70 hover:opacity-100"
+1 -1
View File
@@ -30,7 +30,7 @@ export const importData = createFastMutation({
id: "import", id: "import",
title: "Import Data", title: "Import Data",
size: "sm", size: "sm",
onClose: resolve, disableClose: true,
render: ({ hide }) => { render: ({ hide }) => {
const cancel = () => { const cancel = () => {
hide(); hide();