diff --git a/packages/insomnia/src/ui/components/modals/common-modal.tsx b/packages/insomnia/src/ui/components/modals/common-modal.tsx deleted file mode 100644 index 08c7659b85b..00000000000 --- a/packages/insomnia/src/ui/components/modals/common-modal.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React from 'react'; -import { Button, Dialog, Heading, Modal, ModalOverlay } from 'react-aria-components'; - -interface Props { - title: string; - onOk?: () => void; - okText?: string; - cancelText?: string; - content: string | React.ReactElement; - onClose: () => void; -} - -export const CommonModal = ({ title, onClose, cancelText, okText, content, onOk }: Props) => { - return ( - { - !isOpen && onClose(); - }} - className="w-full h-[--visual-viewport-height] fixed z-10 top-0 left-0 flex items-start justify-center bg-black/30" - > - { - !isOpen && onClose(); - }} - className="flex flex-col max-w-4xl w-full rounded-md border border-solid border-[--hl-sm] p-[--padding-lg] m-[--padding-lg] max-h-full bg-[--color-bg] text-[--color-font]" - > - - {({ close }) => ( - <> - - {title} - -
- {content} -
-
- - -
- - )} -
-
-
- ); -}; diff --git a/packages/insomnia/src/ui/components/modals/variable-missing-error-modal.tsx b/packages/insomnia/src/ui/components/modals/variable-missing-error-modal.tsx new file mode 100644 index 00000000000..df72c8891ad --- /dev/null +++ b/packages/insomnia/src/ui/components/modals/variable-missing-error-modal.tsx @@ -0,0 +1,61 @@ +import React from 'react'; +import { Button, Dialog, Heading, Modal, ModalOverlay } from 'react-aria-components'; + +interface Props { + title: string; + children: React.ReactNode; + isOpen: boolean; + onOk: () => void; + okText?: string; + onCancel: () => void; + cancelText?: string; + isDismissable?: boolean; +} + +export const VariableMissingErrorModal = ({ isOpen, title, cancelText, onCancel, okText, children, onOk, isDismissable = false }: Props) => { + return ( + { + !isOpen && onCancel?.(); + }} + className="w-full h-[--visual-viewport-height] fixed z-10 top-0 left-0 flex items-start justify-center bg-black/30" + > + { + !isOpen && onCancel?.(); + }} + isDismissable={isDismissable} + className="flex flex-col max-w-4xl w-full rounded-md border border-solid border-[--hl-sm] p-[--padding-lg] m-[--padding-lg] max-h-full bg-[--color-bg] text-[--color-font]" + > + + <> + + {title} + +
+ {children} +
+
+ + +
+ +
+
+
+ ); +}; diff --git a/packages/insomnia/src/ui/components/request-url-bar.tsx b/packages/insomnia/src/ui/components/request-url-bar.tsx index 26444f18581..34749a24e41 100644 --- a/packages/insomnia/src/ui/components/request-url-bar.tsx +++ b/packages/insomnia/src/ui/components/request-url-bar.tsx @@ -20,9 +20,9 @@ import { Dropdown, DropdownButton, type DropdownHandle, DropdownItem, DropdownSe import { OneLineEditor, OneLineEditorHandle } from './codemirror/one-line-editor'; import { MethodDropdown } from './dropdowns/method-dropdown'; import { createKeybindingsHandler, useDocBodyKeyboardShortcuts } from './keydown-binder'; -import { CommonModal } from './modals/common-modal'; import { GenerateCodeModal } from './modals/generate-code-modal'; import { showAlert, showModal, showPrompt } from './modals/index'; +import { VariableMissingErrorModal } from './modals/variable-missing-error-modal'; const StyledDropdownButton = styled(DropdownButton)({ '&:hover:not(:disabled)': { @@ -378,7 +378,7 @@ export const RequestUrlBar = forwardRef(({ )} - (({ has been defined but has no value defined on a currently Active Environment

-
+ ); });