From 89630dd788b77974202ee6ca2893fd77b5210117 Mon Sep 17 00:00:00 2001 From: Zane Staggs Date: Wed, 3 Sep 2025 13:25:18 -0700 Subject: [PATCH] remove clicking outside to close so user has to choose an option to proceed or not --- .../src/components/ui/RecipeWarningModal.tsx | 118 ++++++++++-------- 1 file changed, 65 insertions(+), 53 deletions(-) diff --git a/ui/desktop/src/components/ui/RecipeWarningModal.tsx b/ui/desktop/src/components/ui/RecipeWarningModal.tsx index 553b514b8ab1..e94a673301f0 100644 --- a/ui/desktop/src/components/ui/RecipeWarningModal.tsx +++ b/ui/desktop/src/components/ui/RecipeWarningModal.tsx @@ -1,13 +1,16 @@ import { Dialog, - DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, + DialogPortal, + DialogOverlay, } from './dialog'; +import * as DialogPrimitive from '@radix-ui/react-dialog'; import { Button } from './button'; import MarkdownContent from '../MarkdownContent'; +import { cn } from '../../utils'; interface RecipeWarningModalProps { isOpen: boolean; @@ -29,67 +32,76 @@ export function RecipeWarningModal({ hasSecurityWarnings = false, }: RecipeWarningModalProps) { return ( - !open && onCancel()}> - - - - {hasSecurityWarnings ? '⚠️ Security Warning' : '⚠️ New Recipe Warning'} - - - {!hasSecurityWarnings && - "You are about to execute a recipe that you haven't run before. "} - Only proceed if you trust the source of this recipe. - - + + + + e.preventDefault()} + onEscapeKeyDown={(e) => e.preventDefault()} + > + + + {hasSecurityWarnings ? '⚠️ Security Warning' : '⚠️ New Recipe Warning'} + + + {!hasSecurityWarnings && + "You are about to execute a recipe that you haven't run before. "} + Only proceed if you trust the source of this recipe. + + - {hasSecurityWarnings && ( -
-
-
-
-
-

- This recipe contains hidden characters that will be ignored for your safety, - as they could be used for malicious purposes. -

+ {hasSecurityWarnings && ( +
+
+
+
+
+

+ This recipe contains hidden characters that will be ignored for your safety, + as they could be used for malicious purposes. +

+
-
- )} + )} -
-
-

Recipe Preview:

-
- {recipeDetails.title && ( -

- Title: {recipeDetails.title} -

- )} - {recipeDetails.description && ( -

- Description: {recipeDetails.description} -

- )} - {recipeDetails.instructions && ( -
-

Instructions:

- -
- )} +
+
+

Recipe Preview:

+
+ {recipeDetails.title && ( +

+ Title: {recipeDetails.title} +

+ )} + {recipeDetails.description && ( +

+ Description: {recipeDetails.description} +

+ )} + {recipeDetails.instructions && ( +
+

Instructions:

+ +
+ )} +
-
- - - - - + + + + + +
); }