From 304523249710a1fa0fbbe9f9b42aac4513a238f0 Mon Sep 17 00:00:00 2001 From: Nakul Nagargade Date: Wed, 2 Jul 2025 12:25:07 +0530 Subject: [PATCH] Revert "Fix header resizer not coming up on Container, form and modal" This reverts commit 709ab6250289c17fa100cf25a289c7b3c967bd52. --- frontend/src/AppBuilder/Widgets/Container/Container.jsx | 6 +++++- .../Widgets/Form/Components/HorizontalSlot.jsx | 6 +----- frontend/src/AppBuilder/Widgets/Form/Form.jsx | 9 ++++++++- .../src/AppBuilder/Widgets/ModalV2/Components/Footer.jsx | 2 ++ .../src/AppBuilder/Widgets/ModalV2/Components/Header.jsx | 2 ++ .../src/AppBuilder/Widgets/ModalV2/Components/Modal.jsx | 5 ++++- frontend/src/AppBuilder/_hooks/useActiveSlot.js | 1 + 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/frontend/src/AppBuilder/Widgets/Container/Container.jsx b/frontend/src/AppBuilder/Widgets/Container/Container.jsx index de09b4fed0..61775f5919 100644 --- a/frontend/src/AppBuilder/Widgets/Container/Container.jsx +++ b/frontend/src/AppBuilder/Widgets/Container/Container.jsx @@ -33,6 +33,7 @@ export const Container = ({ setExposedVariables, setExposedVariable ); + const { dynamicHeight } = properties; useDynamicHeight({ @@ -50,8 +51,10 @@ export const Container = ({ shallow ); + const isEditing = useStore((state) => state.currentMode === 'edit'); const setComponentProperty = useStore((state) => state.setComponentProperty, shallow); - const activeSlot = useActiveSlot(id); // Track the active slot for this widget + + const activeSlot = useActiveSlot(isEditing ? id : null); // Track the active slot for this widget const { borderRadius, borderColor, boxShadow } = styles; const { headerHeight = 80 } = properties; const headerMaxHeight = parseInt(height, 10) - 100 - 10; @@ -115,6 +118,7 @@ export const Container = ({ { - const { moduleId } = useModuleContext(); - const isEditing = useStore((state) => state.modeStore.modules[moduleId].currentMode === 'edit', shallow); const parsedHeight = parseInt(height, 10); const { getRootProps, getHandleProps, getResizeState } = useSubContainerResizable({ initialHeight: parsedHeight, diff --git a/frontend/src/AppBuilder/Widgets/Form/Form.jsx b/frontend/src/AppBuilder/Widgets/Form/Form.jsx index 065a1592e6..a8da234352 100644 --- a/frontend/src/AppBuilder/Widgets/Form/Form.jsx +++ b/frontend/src/AppBuilder/Widgets/Form/Form.jsx @@ -341,8 +341,13 @@ const FormComponent = (props) => { }); setChildrenData(childDataRef.current); }; - const activeSlot = useActiveSlot(id); // Track the active slot for this widget + + const mode = useStore((state) => state.currentMode, shallow); + const isEditing = mode === 'edit'; + + const activeSlot = useActiveSlot(isEditing ? id : null); // Track the active slot for this widget const setComponentProperty = useStore((state) => state.setComponentProperty, shallow); + // const updateContainerAutoHeight = useStore((state) => state.updateContainerAutoHeight); const updateHeaderSizeInStore = ({ newHeight }) => { const _height = parseInt(newHeight, 10); @@ -383,6 +388,7 @@ const FormComponent = (props) => { { { isFullScreen, } = restProps['modalProps']; + const isEditing = useStore((state) => state.currentMode === 'edit'); const setComponentProperty = useStore((state) => state.setComponentProperty); - const activeSlot = useActiveSlot(id); // Track the active slot for this widget + const activeSlot = useActiveSlot(isEditing ? id : null); // Track the active slot for this widget const _modalHeight = isFullScreen ? '100vh' : `${modalHeight}px`; const headerMaxHeight = isFullScreen ? `calc(${_modalHeight} - ${footerHeight} - 100px - 10px)` @@ -121,6 +122,7 @@ export const ModalWidget = ({ ...restProps }) => { onHideModal={onHideModal} headerHeight={headerHeight} onClick={handleModalSlotClick} + isEditing={isEditing} updateHeaderSizeInStore={updateHeaderSizeInStore} activeSlot={activeSlot} headerMaxHeight={headerMaxHeight} @@ -166,6 +168,7 @@ export const ModalWidget = ({ ...restProps }) => { width={modalWidth} footerHeight={footerHeight} onClick={handleModalSlotClick} + isEditing={isEditing} updateFooterSizeInStore={updateFooterSizeInStore} activeSlot={activeSlot} footerMaxHeight={footerMaxHeight} diff --git a/frontend/src/AppBuilder/_hooks/useActiveSlot.js b/frontend/src/AppBuilder/_hooks/useActiveSlot.js index 5b13f509c9..14f80a366f 100644 --- a/frontend/src/AppBuilder/_hooks/useActiveSlot.js +++ b/frontend/src/AppBuilder/_hooks/useActiveSlot.js @@ -23,6 +23,7 @@ export const useActiveSlot = (widgetId) => { useEffect(() => { const handleDoubleClick = (event) => { let target = event.target; + if (!widgetId) { setActiveSlot(null); return;