From 90cc4023e5d168ba75d1933cc2f989c326121cff Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 26 Jun 2023 11:45:27 -0300 Subject: [PATCH] Added form button to bottom right and copied chat modal --- .../chatComponent/chatTrigger/index.tsx | 2 +- .../chatComponent/formTrigger/index.tsx | 51 +++ .../src/components/chatComponent/index.tsx | 5 + .../src/modals/formModal/chatInput/index.tsx | 78 ++++ .../formModal/chatMessage/codeBlock/index.tsx | 82 ++++ .../modals/formModal/chatMessage/index.tsx | 166 +++++++ .../modals/formModal/fileComponent/index.tsx | 79 ++++ src/frontend/src/modals/formModal/index.tsx | 415 ++++++++++++++++++ 8 files changed, 877 insertions(+), 1 deletion(-) create mode 100644 src/frontend/src/components/chatComponent/formTrigger/index.tsx create mode 100644 src/frontend/src/modals/formModal/chatInput/index.tsx create mode 100644 src/frontend/src/modals/formModal/chatMessage/codeBlock/index.tsx create mode 100644 src/frontend/src/modals/formModal/chatMessage/index.tsx create mode 100644 src/frontend/src/modals/formModal/fileComponent/index.tsx create mode 100644 src/frontend/src/modals/formModal/index.tsx diff --git a/src/frontend/src/components/chatComponent/chatTrigger/index.tsx b/src/frontend/src/components/chatComponent/chatTrigger/index.tsx index db1c030ae..857a628c6 100644 --- a/src/frontend/src/components/chatComponent/chatTrigger/index.tsx +++ b/src/frontend/src/components/chatComponent/chatTrigger/index.tsx @@ -29,7 +29,7 @@ export default function ChatTrigger({ open, setOpen, isBuilt }) { leaveFrom="translate-y-0" leaveTo="translate-y-96" > -
+
+
+
+ +
+
+ + ); +} diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index 6c451fc31..cff74cd46 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -7,9 +7,12 @@ import ChatModal from "../../modals/chatModal"; import { getBuildStatus } from "../../controllers/API"; import { NodeType } from "../../types/flow"; +import FormTrigger from "./formTrigger"; +import FormModal from "../../modals/formModal"; export default function Chat({ flow }: ChatType) { const [open, setOpen] = useState(false); + const [openForm, setOpenForm] = useState(false); const [isBuilt, setIsBuilt] = useState(false); useEffect(() => { @@ -69,7 +72,9 @@ export default function Chat({ flow }: ChatType) { isBuilt={isBuilt} /> + +
) : ( { + if (!lockChat && inputRef.current) { + inputRef.current.focus(); + } + }, [lockChat, inputRef]); + + useEffect(() => { + if (inputRef.current) { + inputRef.current.style.height = "inherit"; // Reset the height + inputRef.current.style.height = `${inputRef.current.scrollHeight}px`; // Set it to the scrollHeight + } + }, [chatValue]); + + return ( +
+