The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix file preview modal to always open full screen from command menu (#16446)
Abdul Rahman1e166ccb53ec
diff --git a/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx b/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsxindex 0015ccb9d0c..8248da083a3 100644--- a/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx+++ b/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx@@ -211,6 +211,7 @@ export const AttachmentList = ({size="large"isClosableonClose={handleClosePreview}+ ignoreContainer><StyledModalHeader><StyledHeader>diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsxindex 7f4435244c6..5857f1ff99c 100644--- a/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx+++ b/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx@@ -15,6 +15,7 @@ import styled from '@emotion/styled';import { AnimatePresence, motion } from 'framer-motion';import React, { useRef } from 'react';import { createPortal } from 'react-dom';+import { isDefined } from 'twenty-shared/utils';const StyledModalDiv = styled(motion.div)<{size?: ModalSize;padding?: ModalPadding;@@ -200,6 +201,7 @@ export type ModalProps = React.PropsWithChildren & {modalVariant?: ModalVariants;dataGloballyPreventClickOutside?: boolean;shouldCloseModalOnClickOutsideOrEscape?: boolean;+ ignoreContainer?: boolean;} & (| { isClosable: true; onClose?: () => void }| { isClosable?: false; onClose?: never }@@ -223,11 +225,13 @@ export const Modal = ({modalVariant = 'primary',dataGloballyPreventClickOutside = false,shouldCloseModalOnClickOutsideOrEscape = true,+ ignoreContainer = false,}: ModalProps) => {const isMobile = useIsMobile();const modalRef = useRef<HTMLDivElement>(null);const { container } = useModalContainer();- const isInContainer = container !== null;+ const effectiveContainer = ignoreContainer ? null : container;+ const isInContainer = isDefined(effectiveContainer);const theme = useTheme();@@ -300,8 +304,8 @@ export const Modal = ({</AnimatePresence>);- if (container !== null) {- return createPortal(modalContent, container);+ if (isDefined(effectiveContainer)) {+ return createPortal(modalContent, effectiveContainer);}return modalContent;