From a624cee8db0e9577656ae43ccb594d3f208b474b Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Wed, 26 Jul 2023 07:55:12 -0300 Subject: [PATCH 01/24] Added Chat Widget HTML API Tab --- .../components/codeTabsComponent/index.tsx | 6 ++-- src/frontend/src/modals/ApiModal/index.tsx | 31 +++++++++++++++++-- src/frontend/src/utils/utils.ts | 26 +++++++++++++++- 3 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/components/codeTabsComponent/index.tsx b/src/frontend/src/components/codeTabsComponent/index.tsx index 1357e0c79..8d68641bb 100644 --- a/src/frontend/src/components/codeTabsComponent/index.tsx +++ b/src/frontend/src/components/codeTabsComponent/index.tsx @@ -145,7 +145,7 @@ export default function CodeTabsComponent({ ))} - {Number(activeTab) < 3 && ( + {Number(activeTab) < 4 && (
- - - - -
- -
-
-
- - {flow && flow.data && ( - +
+ + + +
+
+ +
- +
- - )} -
- - - - + + +
+
+ + {flow && flow.data && ( + +
+ +
+
+ )} +
+
+
+ + + +
From 40daa06d7546fcdc7d6c3976b11fe2412b2ce43c Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Wed, 26 Jul 2023 14:16:34 -0300 Subject: [PATCH 07/24] Added class --- src/frontend/src/style/applies.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/frontend/src/style/applies.css b/src/frontend/src/style/applies.css index 2a782946e..9da06dd9c 100644 --- a/src/frontend/src/style/applies.css +++ b/src/frontend/src/style/applies.css @@ -78,6 +78,9 @@ .side-bar-buttons-arrangement { @apply mb-2 mt-2 flex w-full items-center justify-between gap-2 px-2 } + .side-bar-button { + @apply flex w-full + } .extra-side-bar-buttons { @apply relative inline-flex w-full items-center justify-center rounded-md bg-background px-2 py-2 text-foreground shadow-sm ring-1 ring-inset ring-input transition-all duration-500 ease-in-out } From eb0883231b25bc7f0eba313b8c50b327c55c28ee Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Wed, 26 Jul 2023 15:36:35 -0300 Subject: [PATCH 08/24] Changed way of disabling sidebar button; Disabled API button before building. --- .../src/components/chatComponent/index.tsx | 3 +-- src/frontend/src/contexts/tabsContext.tsx | 6 ++++++ src/frontend/src/modals/ApiModal/index.tsx | 4 +++- src/frontend/src/modals/baseModal/index.tsx | 7 ++++++- .../components/extraSidebarComponent/index.tsx | 14 +++++++++----- src/frontend/src/style/applies.css | 3 +++ src/frontend/src/types/tabs/index.ts | 2 ++ 7 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index 58c058866..3cbe5bbf1 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -12,9 +12,8 @@ import { NodeType } from "../../types/flow"; export default function Chat({ flow }: ChatType) { const [open, setOpen] = useState(false); - const [isBuilt, setIsBuilt] = useState(false); const [canOpen, setCanOpen] = useState(false); - const { tabsState } = useContext(TabsContext); + const { tabsState, isBuilt, setIsBuilt } = useContext(TabsContext); useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index d12fa18ba..9ae22de4d 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -40,6 +40,8 @@ const TabsContextInitialValue: TabsContextType = { downloadFlows: () => {}, uploadFlows: () => {}, uploadFlow: () => {}, + isBuilt: false, + setIsBuilt: (state: boolean) => {}, hardReset: () => {}, saveFlow: async (flow: FlowType) => {}, lastCopiedSelection: null, @@ -583,10 +585,14 @@ export function TabsProvider({ children }: { children: ReactNode }) { } } + const [isBuilt, setIsBuilt] = useState(false); + return ( { @@ -278,7 +280,7 @@ const ApiModal = forwardRef( } return ( - + {children} Code diff --git a/src/frontend/src/modals/baseModal/index.tsx b/src/frontend/src/modals/baseModal/index.tsx index e679c2d89..45f9353db 100644 --- a/src/frontend/src/modals/baseModal/index.tsx +++ b/src/frontend/src/modals/baseModal/index.tsx @@ -46,11 +46,13 @@ interface BaseModalProps { ]; open?: boolean; setOpen?: (open: boolean) => void; + disable?: boolean; size?: "smaller" | "small" | "medium" | "large" | "large-h-full"; } function BaseModal({ open, setOpen, + disable = false, children, size = "large", }: BaseModalProps) { @@ -99,7 +101,10 @@ function BaseModal({ //UPDATE COLORS AND STYLE CLASSSES return ( -