mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-25 21:04:04 +02:00
Prevent dismissing active imports
This commit is contained in:
@@ -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"
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user