From 5a0a9221b9be0d9a6217185a34aead6f3116b9d0 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 11 May 2023 21:46:55 -0300 Subject: [PATCH] fixed copy and paste bug --- .../src/components/floatComponent/index.tsx | 10 +++++++++- .../src/components/inputComponent/index.tsx | 10 +++++++++- .../components/inputListComponent/index.tsx | 10 +++++++++- .../src/components/intComponent/index.tsx | 11 +++++++++- src/frontend/src/contexts/tabsContext.tsx | 5 +++++ src/frontend/src/modals/exportModal/index.tsx | 20 ++++++++++++++++++- .../components/tabComponent/index.tsx | 6 +++++- src/frontend/src/pages/FlowPage/index.tsx | 6 +++--- src/frontend/src/types/tabs/index.ts | 3 +++ 9 files changed, 72 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/components/floatComponent/index.tsx b/src/frontend/src/components/floatComponent/index.tsx index 3a09527da..11a1dedbc 100644 --- a/src/frontend/src/components/floatComponent/index.tsx +++ b/src/frontend/src/components/floatComponent/index.tsx @@ -1,5 +1,6 @@ -import { useEffect, useState } from "react"; +import { useContext, useEffect, useState } from "react"; import { FloatComponentType } from "../../types/components"; +import { TabsContext } from "../../contexts/tabsContext"; export default function FloatComponent({ value, @@ -13,6 +14,7 @@ export default function FloatComponent({ onChange(""); } }, [disabled, onChange]); + const {setDisableCP} = useContext(TabsContext) return (
{ + setDisableCP(false) + }} + onFocus={() => { + setDisableCP(true) + }} />
); diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 05be68532..778d9d6ef 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -1,6 +1,7 @@ -import { useEffect, useState } from "react"; +import { useContext, useEffect, useState } from "react"; import { InputComponentType } from "../../types/components"; import { classNames } from "../../utils"; +import { TabsContext } from "../../contexts/tabsContext"; export default function InputComponent({ value, @@ -10,6 +11,7 @@ export default function InputComponent({ }: InputComponentType) { const [myValue, setMyValue] = useState(value ?? ""); const [pwdVisible, setPwdVisible] = useState(false); + const {setDisableCP} = useContext(TabsContext) useEffect(() => { if (disabled) { setMyValue(""); @@ -26,6 +28,12 @@ export default function InputComponent({ > { + setDisableCP(false) + }} + onFocus={() => { + setDisableCP(true) + }} className={classNames( "block w-full pr-12 form-input dark:bg-gray-900 dark:border-gray-600 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm", disabled ? " bg-gray-200 dark:bg-gray-700" : "", diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 5381074a2..0effce921 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -1,6 +1,7 @@ import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline"; -import { useEffect, useState } from "react"; +import { useContext, useEffect, useState } from "react"; import { InputListComponentType } from "../../types/components"; +import { TabsContext } from "../../contexts/tabsContext"; var _ = require("lodash"); @@ -16,6 +17,7 @@ export default function InputListComponent({ onChange([""]); } }, [disabled, onChange]); + const {setDisableCP} = useContext(TabsContext) return (
{ + setDisableCP(false) + }} + onFocus={() => { + setDisableCP(true) + }} /> {idx === inputList.length - 1 ? (
); } diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 9905051b2..db122ebb2 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -26,6 +26,8 @@ const TabsContextInitialValue: TabsContextType = { downloadFlow: (flow: FlowType) => {}, uploadFlow: () => {}, hardReset: () => {}, + disableCP:false, + setDisableCP:(state:boolean)=>{}, }; export const TabsContext = createContext( @@ -212,10 +214,13 @@ export function TabsProvider({ children }: { children: ReactNode }) { return newFlows; }); } + const [disableCP, setDisableCP] = useState(false); return ( { + setDisableCP(false); + }} + onFocus={() => { + setDisableCP(true); + }} />
@@ -127,6 +133,12 @@ export default function ExportModal() {