diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/chat-input.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/chat-input.tsx index 9c4f25b8b..e2796cc93 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/chat-input.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/chat-input.tsx @@ -1,4 +1,5 @@ import { usePostUploadFile } from "@/controllers/API/queries/files/use-post-upload-file"; +import { ENABLE_IMAGE_ON_PLAYGROUND } from "@/customization/feature-flags"; import useFileSizeValidator from "@/shared/hooks/use-file-size-validator"; import useAlertStore from "@/stores/alertStore"; import useFlowStore from "@/stores/flowStore"; @@ -64,7 +65,7 @@ export default function ChatInput({ const handleFileChange = async ( event: React.ChangeEvent | ClipboardEvent, ) => { - if (playgroundPage) { + if (playgroundPage && !ENABLE_IMAGE_ON_PLAYGROUND) { return; } diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/input-wrapper.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/input-wrapper.tsx index 4f2d517da..947f7f522 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/input-wrapper.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/components/input-wrapper.tsx @@ -84,7 +84,8 @@ const InputWrapper: React.FC = ({
- {!playgroundPage && ENABLE_IMAGE_ON_PLAYGROUND && ( + {(!playgroundPage || + (playgroundPage && ENABLE_IMAGE_ON_PLAYGROUND)) && ( void) => { +const useDragAndDrop = ( + setIsDragging: (value: boolean) => void, + playgroundPage: boolean, +) => { const dragOver = (e) => { - if (!ENABLE_IMAGE_ON_PLAYGROUND) return; + if (!ENABLE_IMAGE_ON_PLAYGROUND && playgroundPage) return; e.preventDefault(); if (e.dataTransfer.types.some((type) => type === "Files")) { setIsDragging(true); @@ -10,7 +13,7 @@ const useDragAndDrop = (setIsDragging: (value: boolean) => void) => { }; const dragEnter = (e) => { - if (!ENABLE_IMAGE_ON_PLAYGROUND) return; + if (!ENABLE_IMAGE_ON_PLAYGROUND && playgroundPage) return; if (e.dataTransfer.types.some((type) => type === "Files")) { setIsDragging(true); } @@ -18,6 +21,7 @@ const useDragAndDrop = (setIsDragging: (value: boolean) => void) => { }; const dragLeave = (e) => { + if (!ENABLE_IMAGE_ON_PLAYGROUND && playgroundPage) return; e.preventDefault(); setIsDragging(false); }; diff --git a/src/frontend/src/modals/IOModal/components/chatView/components/chat-view.tsx b/src/frontend/src/modals/IOModal/components/chatView/components/chat-view.tsx index 5a22b6b62..23050e140 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/components/chat-view.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/components/chat-view.tsx @@ -148,10 +148,13 @@ export default function ChatView({ const { files, setFiles, handleFiles } = useFileHandler(currentFlowId); const [isDragging, setIsDragging] = useState(false); - const { dragOver, dragEnter, dragLeave } = useDragAndDrop(setIsDragging); + const { dragOver, dragEnter, dragLeave } = useDragAndDrop( + setIsDragging, + !!playgroundPage, + ); const onDrop = (e) => { - if (!ENABLE_IMAGE_ON_PLAYGROUND) { + if (!ENABLE_IMAGE_ON_PLAYGROUND && playgroundPage) { e.stopPropagation(); return; }