From 244fe5c123e33fe07eb632c5c37e87f8877fcddb Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Fri, 9 Jun 2023 16:41:34 -0300 Subject: [PATCH 01/17] Adjusted state of toggle buttons and inputComp --- .../components/parameterComponent/index.tsx | 3 +++ .../components/ShadTooltipComponent/index.tsx | 16 +++++++++------- .../src/components/inputComponent/index.tsx | 7 +++++++ src/frontend/src/modals/EditNodeModal/index.tsx | 6 ++---- src/frontend/src/types/components/index.ts | 3 +++ 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index d6ca1fe90..55256951b 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -40,6 +40,7 @@ export default function ParameterComponent({ const refHtml = useRef(null); const updateNodeInternals = useUpdateNodeInternals(); const [position, setPosition] = useState(0); + useEffect(() => { if (ref.current && ref.current.offsetTop && ref.current.clientHeight) { setPosition(ref.current.offsetTop + ref.current.clientHeight / 2); @@ -54,6 +55,7 @@ export default function ParameterComponent({ const [enabled, setEnabled] = useState( data.node.template[name]?.value ?? false ); + const { reactFlowInstance } = useContext(typesContext); let disabled = reactFlowInstance?.getEdges().some((e) => e.targetHandle === id) ?? false; @@ -125,6 +127,7 @@ export default function ParameterComponent({ delayDuration={0} content={refHtml.current} side={left ? "left" : "right"} + open={refHtml?.current?.length > 0} > { {props.children} - - {props.content} - + {props.open && ( + + {props.content} + + )} ); diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index a4072e9c1..b7b245c75 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -2,6 +2,7 @@ import { useContext, useEffect, useState } from "react"; import { InputComponentType } from "../../types/components"; import { classNames } from "../../utils"; import { TabsContext } from "../../contexts/tabsContext"; +import { PopUpContext } from "../../contexts/popUpContext"; export default function InputComponent({ value, @@ -14,6 +15,8 @@ export default function InputComponent({ const [myValue, setMyValue] = useState(value ?? ""); const [pwdVisible, setPwdVisible] = useState(false); const { setDisableCopyPaste } = useContext(TabsContext); + const { closePopUp } = useContext(PopUpContext); + useEffect(() => { if (disabled) { setMyValue(""); @@ -21,6 +24,10 @@ export default function InputComponent({ } }, [disabled, onChange]); + useEffect(() => { + setMyValue(value ?? ""); + }, [closePopUp]); + return (
diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index 419710cfe..8eb66d32b 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -13,11 +13,14 @@ export type InputComponentType = { password: boolean; disableCopyPaste?: boolean; editNode?: boolean; + onChangePass?: (value: boolean | boolean) => void; + showPass?: boolean; }; export type ToggleComponentType = { enabled: boolean; setEnabled: (state: boolean) => void; disabled: boolean; + name?: string; }; export type DropDownComponentType = { value: string; From ef1b19a6d3a1f3589745c1c5246ea58df54e38f5 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Fri, 9 Jun 2023 16:43:10 -0300 Subject: [PATCH 02/17] Removing unnecessary prop --- src/frontend/src/types/components/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index 8eb66d32b..6a4b9c369 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -20,7 +20,6 @@ export type ToggleComponentType = { enabled: boolean; setEnabled: (state: boolean) => void; disabled: boolean; - name?: string; }; export type DropDownComponentType = { value: string; From 74b8cbb22490d23a58524db4ac6d8e89ad0d48e3 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Sun, 11 Jun 2023 10:48:42 -0300 Subject: [PATCH 03/17] dropdown float, placeholders and inputlist bug fix --- .../src/components/codeAreaComponent/index.tsx | 2 +- .../src/components/dropdownComponent/index.tsx | 15 ++++++--------- .../src/components/inputListComponent/index.tsx | 7 +++++-- .../src/components/promptComponent/index.tsx | 4 ++-- .../src/components/textAreaComponent/index.tsx | 2 +- src/frontend/src/modals/EditNodeModal/index.tsx | 2 ++ src/frontend/src/types/components/index.ts | 2 ++ 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index 7ba38918b..b1c907998 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -40,7 +40,7 @@ export default function CodeAreaComponent({ }} className={ editNode - ? "h-7 truncate placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + ? "h-7 truncate cursor-pointer placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" : "truncate block w-full text-gray-500 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + (disabled ? " bg-gray-200" : "") } diff --git a/src/frontend/src/components/dropdownComponent/index.tsx b/src/frontend/src/components/dropdownComponent/index.tsx index 48c41d118..c7479abfb 100644 --- a/src/frontend/src/components/dropdownComponent/index.tsx +++ b/src/frontend/src/components/dropdownComponent/index.tsx @@ -9,6 +9,7 @@ export default function Dropdown({ options, onSelect, editNode = false, + numberOfOptions = 0, }: DropDownComponentType) { let [internalValue, setInternalValue] = useState( value === "" || !value ? "Choose an option" : value @@ -25,16 +26,12 @@ export default function Dropdown({ > {({ open }) => ( <> -
+
{internalValue} @@ -62,8 +59,8 @@ export default function Dropdown({ {options.map((option, id) => ( diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 49b0a1a5a..5f5e1f04e 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -9,6 +9,7 @@ export default function InputListComponent({ value, onChange, disabled, + editNode = false, }: InputListComponentType) { const [inputList, setInputList] = useState(value ?? [""]); useEffect(() => { @@ -30,8 +31,10 @@ export default function InputListComponent({ type="text" value={i} className={ - "block w-full form-input rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + - (disabled ? " bg-gray-200" : "") + editNode + ? "h-7 truncate cursor-pointer text-center placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + : "block w-full form-input rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + + (disabled ? " bg-gray-200" : "") } placeholder="Type something..." onChange={(e) => { diff --git a/src/frontend/src/components/promptComponent/index.tsx b/src/frontend/src/components/promptComponent/index.tsx index a1729ef99..bbe9c3bf8 100644 --- a/src/frontend/src/components/promptComponent/index.tsx +++ b/src/frontend/src/components/promptComponent/index.tsx @@ -45,12 +45,12 @@ export default function PromptAreaComponent({ }} className={ editNode - ? "h-7 truncate placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + ? "h-7 cursor-pointer truncate placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" : "truncate block w-full text-gray-500 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + (disabled ? " bg-gray-200" : "") } > - {myValue !== "" ? myValue : "-"} + {myValue !== "" ? myValue : "Type your prompt here"}
- {showExamples && ( - <> -
- -
- - )} -
-
-
-
-
- - {showExamples ? "Select an example" : "Import"} - -
-
-
- {!showExamples && ( -
- - } - onClick={() => { - setShowExamples(true); - handleExamples(); - }} - textColor="text-emerald-500 dark:text-emerald-500/75" - title="Examples" - > - - } - onClick={() => { - uploadFlow(); - setModalOpen(false); - }} - textColor="text-blue-500 dark:text-blue-500/75" - title="Local File" - > -
- )} - {showExamples && loadingExamples && ( -
- -
- )} - {showExamples && - !loadingExamples && - examples.map((example, index) => { - return ( -
- {" "} - - } - onClick={() => { - addFlow(example); - setModalOpen(false); - }} - textColor="text-emerald-500 dark:text-emerald-500/75" - title={example.name} - > -
- ); - })} -
- + + )} + + + {showExamples ? "Select an example" : "Import"} + +
- - + + + + + + ); } diff --git a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx index f0fe333d5..17eae19f2 100644 --- a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx @@ -56,7 +56,7 @@ export default function ExtraSidebar() { name="search" id="search" placeholder="Search nodes" - className="dark:text-white focus:outline-none block w-full rounded-md py-1.5 ps-3 pr-9 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 sm:text-sm sm:leading-6 dark:ring-0 dark:bg-[#2d3747] dark:focus:outline-none" + className="border-1 dark:border-slate-600 dark:border-0.5 dark:ring-0 focus-visible:dark:ring-0 focus-visible:dark:ring-offset-1 rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50" onChange={(e) => { handleSearchInput(e.target.value); setSearch(e.target.value); From 9ccd7e4fb3b15f1a13bfa59907b7be04fc690fa1 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 13 Jun 2023 21:03:25 -0300 Subject: [PATCH 09/17] adding background muted and subtitle texts changes --- .../components/codeAreaComponent/index.tsx | 2 +- .../src/components/floatComponent/index.tsx | 19 +++++++++++++++++-- .../src/components/inputComponent/index.tsx | 16 ++++++++++++---- .../components/inputListComponent/index.tsx | 3 ++- .../src/components/intComponent/index.tsx | 12 ++++++++++-- .../components/textAreaComponent/index.tsx | 2 +- src/frontend/src/constants.tsx | 17 ++++++++++------- src/frontend/src/modals/ApiModal/index.tsx | 2 +- .../src/modals/EditNodeModal/index.tsx | 6 +++--- .../src/modals/codeAreaModal/index.tsx | 2 +- src/frontend/src/modals/exportModal/index.tsx | 2 +- .../src/modals/genericModal/index.tsx | 2 +- src/frontend/src/modals/importModal/index.tsx | 8 ++++---- .../extraSidebarComponent/index.tsx | 2 +- src/frontend/src/utils.ts | 2 +- 15 files changed, 66 insertions(+), 31 deletions(-) diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index b1c907998..6f4af1635 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -45,7 +45,7 @@ export default function CodeAreaComponent({ (disabled ? " bg-gray-200" : "") } > - {myValue !== "" ? myValue : "Text empty"} + {myValue !== "" ? myValue : "Type something..."} @@ -176,7 +176,7 @@ export default function ImportModal() {
-
+
-
+
) { return classes.filter(Boolean).join(" "); } -export const limitScrollFieldsModal = 7; +export const limitScrollFieldsModal = 10; export enum TypeModal { TEXT = 1, From fdaffc573431ca71b20b4d17e361b428e1f05864 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 13 Jun 2023 21:08:00 -0300 Subject: [PATCH 10/17] changing python code heigth --- src/frontend/src/modals/ApiModal/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx index 6198c2b33..52a0adb55 100644 --- a/src/frontend/src/modals/ApiModal/index.tsx +++ b/src/frontend/src/modals/ApiModal/index.tsx @@ -90,7 +90,7 @@ flow("Hey, have you heard of LangFlow?")`; return ( - + Code @@ -141,7 +141,7 @@ flow("Hey, have you heard of LangFlow?")`;
Date: Wed, 14 Jun 2023 00:01:55 -0300 Subject: [PATCH 11/17] UI adjusts --- .../src/components/ExtraSidebarComponent/index.tsx | 5 +---- .../src/components/codeAreaComponent/index.tsx | 2 +- .../src/components/floatComponent/index.tsx | 4 ++-- .../src/components/inputComponent/index.tsx | 4 ++-- .../src/components/inputListComponent/index.tsx | 14 ++++++++++---- src/frontend/src/components/intComponent/index.tsx | 2 +- .../src/components/loadingComponent/index.tsx | 2 +- .../src/components/promptComponent/index.tsx | 2 +- .../src/components/textAreaComponent/index.tsx | 10 ++++++++-- src/frontend/src/constants.tsx | 7 +++++++ src/frontend/src/modals/ApiModal/index.tsx | 13 ++++++------- src/frontend/src/modals/EditNodeModal/index.tsx | 14 +++++++------- src/frontend/src/modals/codeAreaModal/index.tsx | 4 ++-- src/frontend/src/modals/exportModal/index.tsx | 2 +- src/frontend/src/modals/genericModal/index.tsx | 2 +- src/frontend/src/modals/importModal/index.tsx | 6 +++--- 16 files changed, 54 insertions(+), 39 deletions(-) diff --git a/src/frontend/src/components/ExtraSidebarComponent/index.tsx b/src/frontend/src/components/ExtraSidebarComponent/index.tsx index b06a58d9c..3208cc1f0 100644 --- a/src/frontend/src/components/ExtraSidebarComponent/index.tsx +++ b/src/frontend/src/components/ExtraSidebarComponent/index.tsx @@ -21,10 +21,7 @@ export default function ExtraSidebar() { isStackedOpen ? "w-52" : "w-0 " } flex-shrink-0 flex overflow-hidden flex-col border-r dark:border-r-gray-700 transition-all duration-500`} > -
-
- -
+
{extraNavigation.options ? (
diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index 6f4af1635..e1c8d5584 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -40,7 +40,7 @@ export default function CodeAreaComponent({ }} className={ editNode - ? "h-7 truncate cursor-pointer placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + ? "truncate cursor-pointer placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" : "truncate block w-full text-gray-500 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + (disabled ? " bg-gray-200" : "") } diff --git a/src/frontend/src/components/floatComponent/index.tsx b/src/frontend/src/components/floatComponent/index.tsx index 30441443e..cf80cef7d 100644 --- a/src/frontend/src/components/floatComponent/index.tsx +++ b/src/frontend/src/components/floatComponent/index.tsx @@ -50,8 +50,8 @@ export default function FloatComponent({ value={myValue} className={ editNode - ? "focus:placeholder-transparent text-center placeholder:text-center border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" - : "focus:placeholder-transparent block w-full form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 sm:text-sm" + + ? "focus:placeholder-transparent text-center placeholder:text-center border-1 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + : "focus:placeholder-transparent block w-full form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm ring-offset-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 sm:text-sm" + (disabled ? " bg-gray-200 dark:bg-gray-700" : "") } placeholder={ diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 8c3263ead..55ae977a7 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -49,8 +49,8 @@ export default function InputComponent({ disabled ? " bg-gray-200 dark:bg-gray-700" : "", password && !pwdVisible && myValue !== "" ? "password" : "", editNode - ? "border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200 text-center" - : "ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", + ? "border-1 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200 text-center" + : "ring-offset-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", password && editNode ? "pr-8" : "pr-3" )} placeholder={password && editNode ? "Key" : "Type something..."} diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index 0eadcd78d..ea4c27134 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -22,7 +22,7 @@ export default function InputListComponent({
{inputList.map((i, idx) => ( @@ -32,8 +32,8 @@ export default function InputListComponent({ value={i} className={ editNode - ? "h-7 truncate cursor-pointer text-center placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" - : "block w-full form-input rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" + + ? "border-[1px] truncate cursor-pointer text-center placeholder:text-center text-gray-500 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200" + : "block w-full form-input rounded-md border-gray-300 shadow-sm focus:border-gray-500 focus:ring-gray-500 sm:text-sm" + (disabled ? " bg-gray-200" : "") + "focus:placeholder-transparent" } @@ -58,7 +58,13 @@ export default function InputListComponent({ onChange(inputList); }} > - + ) : ( ))}
-
+