From eb0883231b25bc7f0eba313b8c50b327c55c28ee Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Wed, 26 Jul 2023 15:36:35 -0300 Subject: [PATCH] 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 ( -