From 243b59507b4f7f87518060b908426a0f9e933241 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Mon, 10 Jul 2023 10:29:09 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(parameterComponent):=20use?= =?UTF-8?q?=20strict=20equality=20operator=20(=3D=3D=3D)=20instead=20of=20?= =?UTF-8?q?loose=20equality=20operator=20(=3D=3D)=20for=20item.type=20comp?= =?UTF-8?q?arison=20to=20improve=20code=20quality=20and=20avoid=20potentia?= =?UTF-8?q?l=20bugs=20=F0=9F=90=9B=20fix(parameterComponent):=20update=20s?= =?UTF-8?q?tyle=20prop=20value=20in=20ShadTooltip=20component=20to=20use?= =?UTF-8?q?=20class=20names=20'tooltip-fixed-width'=20and=20'custom-scroll?= =?UTF-8?q?'=20for=20consistent=20styling=20and=20better=20readability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(parameterComponent):=20update=20disabled=20p?= =?UTF-8?q?rop=20value=20in=20TextAreaComponent=20to=20use=20the=20disable?= =?UTF-8?q?d=20variable=20passed=20as=20a=20prop=20for=20consistency=20and?= =?UTF-8?q?=20better=20code=20organization=20=F0=9F=90=9B=20fix(AccordionC?= =?UTF-8?q?omponent):=20use=20strict=20equality=20operator=20(=3D=3D=3D)?= =?UTF-8?q?=20instead=20of=20loose=20equality=20operator=20(=3D=3D)=20for?= =?UTF-8?q?=20open.length=20comparison=20to=20improve=20code=20quality=20a?= =?UTF-8?q?nd=20avoid=20potential=20bugs=20=F0=9F=90=9B=20fix(codeAreaComp?= =?UTF-8?q?onent):=20remove=20unnecessary=20space=20in=20className=20prop?= =?UTF-8?q?=20value=20to=20improve=20code=20readability=20=F0=9F=90=9B=20f?= =?UTF-8?q?ix(codeAreaComponent):=20remove=20unnecessary=20space=20in=20cl?= =?UTF-8?q?assName=20prop=20value=20to=20improve=20code=20readability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(codeAreaComponent):=20remove=20unnecessary?= =?UTF-8?q?=20space=20in=20className=20prop=20value=20to=20improve=20code?= =?UTF-8?q?=20readability=20=F0=9F=90=9B=20fix(codeAreaComponent):=20remov?= =?UTF-8?q?e=20unnecessary=20space=20in=20className=20prop=20value=20to=20?= =?UTF-8?q?improve=20code=20readability=20=F0=9F=90=9B=20fix(inputFileComp?= =?UTF-8?q?onent):=20remove=20unnecessary=20space=20in=20className=20prop?= =?UTF-8?q?=20value=20to=20improve=20code=20readability=20=F0=9F=90=9B=20f?= =?UTF-8?q?ix(inputFileComponent):=20remove=20unnecessary=20space=20in=20c?= =?UTF-8?q?lassName=20prop=20value=20to=20improve=20code=20readability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(inputFileComponent):=20remove=20unnecessary?= =?UTF-8?q?=20space=20in=20className=20prop=20value=20to=20improve=20code?= =?UTF-8?q?=20readability=20=F0=9F=90=9B=20fix(inputFileComponent):=20remo?= =?UTF-8?q?ve=20unnecessary=20space=20in=20className=20prop=20value=20to?= =?UTF-8?q?=20improve=20code=20readability=20=F0=9F=90=9B=20fix(intCompone?= =?UTF-8?q?nt):=20remove=20unnecessary=20space=20in=20className=20prop=20v?= =?UTF-8?q?alue=20to=20improve=20code=20readability=20=F0=9F=90=9B=20fix(i?= =?UTF-8?q?ntComponent):=20remove=20unnecessary=20space=20in=20className?= =?UTF-8?q?=20prop=20value=20to=20improve=20code=20readability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(promptComponent):=20add=20missing=20dependen?= =?UTF-8?q?cies=20to=20useEffect=20dependency=20array=20to=20avoid=20poten?= =?UTF-8?q?tial=20bugs=20and=20improve=20code=20quality=20=F0=9F=90=9B=20f?= =?UTF-8?q?ix(promptComponent):=20remove=20unnecessary=20space=20in=20clas?= =?UTF-8?q?sName=20prop=20value=20to=20improve=20code=20readability=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(textAreaComponent):=20remove=20unnecessary?= =?UTF-8?q?=20space=20in=20className=20prop=20value=20to=20improve=20code?= =?UTF-8?q?=20readability=20=F0=9F=90=9B=20fix(textAreaComponent):=20remov?= =?UTF-8?q?e=20unnecessary=20space=20in=20className=20prop=20value=20to=20?= =?UTF-8?q?improve=20code=20readability=20=F0=9F=90=9B=20fix(tabsContext):?= =?UTF-8?q?=20change=20getTweak=20initial=20state=20from=20an=20object=20t?= =?UTF-8?q?o=20an=20empty=20array=20to=20match=20the=20expected=20type=20a?= =?UTF-8?q?nd=20avoid=20potential=20bugs=20=F0=9F=90=9B=20fix(ApiModal):?= =?UTF-8?q?=20add=20missing=20curly=20braces=20around=20the=20buildTweaks?= =?UTF-8?q?=20function=20call=20to=20ensure=20the=20correct=20value=20is?= =?UTF-8?q?=20pushed=20to=20the=20tweak.current=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix(EditNodeModal): remove unnecessary 'save' variable from useContext destructuring 🐛 fix(chatMessage): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(chatModal): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(codeAreaModal): add 'setCloseEdit' to useContext destructuring and add 'setModalOpen' function 🐛 fix(chatInput): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(chatMessage): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(formModal): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(formModal): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(formModal): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(formModal): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(genericModal): use strict equality operator (===) instead of loose equality operator (==) for comparison 🐛 fix(flow): add missing newline at the end of the file 🐛 fix(tabs): add missing import for TweaksType from flow 🐛 fix(utils.ts): change comparison operator from '==' to '===' for better type safety and strict equality check --- .../components/parameterComponent/index.tsx | 6 +++--- .../src/components/AccordionComponent/index.tsx | 2 +- .../src/components/codeAreaComponent/index.tsx | 15 ++++----------- .../src/components/inputFileComponent/index.tsx | 6 ++---- .../src/components/intComponent/index.tsx | 4 ++-- .../src/components/promptComponent/index.tsx | 7 +++---- .../src/components/textAreaComponent/index.tsx | 10 +++------- src/frontend/src/contexts/tabsContext.tsx | 4 ++-- src/frontend/src/index.css | 6 +++++- src/frontend/src/modals/ApiModal/index.tsx | 9 +++++---- src/frontend/src/modals/EditNodeModal/index.tsx | 2 +- .../src/modals/chatModal/chatMessage/index.tsx | 2 +- src/frontend/src/modals/chatModal/index.tsx | 2 +- src/frontend/src/modals/codeAreaModal/index.tsx | 10 +++++++++- .../src/modals/formModal/chatInput/index.tsx | 2 +- .../src/modals/formModal/chatMessage/index.tsx | 6 +++--- src/frontend/src/modals/formModal/index.tsx | 8 +++++--- src/frontend/src/modals/genericModal/index.tsx | 11 +++++------ src/frontend/src/types/flow/index.ts | 9 +++++++++ src/frontend/src/types/tabs/index.ts | 6 +++--- src/frontend/src/utils.ts | 8 ++++---- 21 files changed, 72 insertions(+), 63 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index caa14975f..3d931fbe2 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -122,7 +122,7 @@ export default function ParameterComponent({ {nodeNames[item.family] ?? ""}{" "} {" "} - {item.type == "" ? "" : " - "} + {item.type === "" ? "" : " - "} {item.type.split(", ").length > 2 ? item.type.split(", ").map((el, i) => ( @@ -176,7 +176,7 @@ export default function ParameterComponent({ <> ) : ( ) : data.node.template[name].multiline ? ( diff --git a/src/frontend/src/components/AccordionComponent/index.tsx b/src/frontend/src/components/AccordionComponent/index.tsx index ceeb938a8..3b0ddd596 100644 --- a/src/frontend/src/components/AccordionComponent/index.tsx +++ b/src/frontend/src/components/AccordionComponent/index.tsx @@ -13,7 +13,7 @@ export default function AccordionComponent({ open = [], }: AccordionComponentType) { const [value, setValue] = useState( - open.length == 0 ? "" : getOpenAccordion() + open.length === 0 ? "" : getOpenAccordion() ); function getOpenAccordion() { diff --git a/src/frontend/src/components/codeAreaComponent/index.tsx b/src/frontend/src/components/codeAreaComponent/index.tsx index 07ceb0593..0f0013c1e 100644 --- a/src/frontend/src/components/codeAreaComponent/index.tsx +++ b/src/frontend/src/components/codeAreaComponent/index.tsx @@ -27,15 +27,10 @@ export default function CodeAreaComponent({ useEffect(() => { setMyValue(typeof value == "string" ? value : JSON.stringify(value)); }, [value]); + return ( -
-
+
{ @@ -53,9 +48,8 @@ export default function CodeAreaComponent({ }} className={ editNode - ? "input-edit-node input-dialog " - : "input-dialog input-primary " + - (disabled ? "input-disable" : "") + ? "input-edit-node" + : "input-primary text-muted-foreground" + (disabled ? " input-disable" : "") } > {myValue !== "" ? myValue : "Type something..."} @@ -87,6 +81,5 @@ export default function CodeAreaComponent({
-
); } diff --git a/src/frontend/src/components/inputFileComponent/index.tsx b/src/frontend/src/components/inputFileComponent/index.tsx index fc69e5f95..c4ae9925b 100644 --- a/src/frontend/src/components/inputFileComponent/index.tsx +++ b/src/frontend/src/components/inputFileComponent/index.tsx @@ -98,10 +98,8 @@ export default function InputFileComponent({ onClick={handleButtonClick} className={ editNode - ? " input-edit-node " + " input-dialog " - : (disabled ? " input-disable " : "") + - " input-primary " + - " input-dialog " + ? "input-edit-node input-dialog text-muted-foreground" + : (disabled ? "input-disable input-primary input-dialog" : "input-primary input-dialog text-muted-foreground") } > {myValue !== "" ? myValue : "No file"} diff --git a/src/frontend/src/components/intComponent/index.tsx b/src/frontend/src/components/intComponent/index.tsx index 2428d03ee..09c342712 100644 --- a/src/frontend/src/components/intComponent/index.tsx +++ b/src/frontend/src/components/intComponent/index.tsx @@ -30,7 +30,7 @@ export default function IntComponent({
{ diff --git a/src/frontend/src/components/promptComponent/index.tsx b/src/frontend/src/components/promptComponent/index.tsx index 7385518c8..f02c85ba9 100644 --- a/src/frontend/src/components/promptComponent/index.tsx +++ b/src/frontend/src/components/promptComponent/index.tsx @@ -44,7 +44,7 @@ export default function PromptAreaComponent({ }) .catch((error) => {}); } - }, [reactFlowInstance, field_name]); + }, [reactFlowInstance, field_name, myValue, nodeClass, setNodeClass]); return (
@@ -69,10 +69,9 @@ export default function PromptAreaComponent({ }} className={ editNode - ? " input-edit-node " + " input-dialog " + ? "input-edit-node input-dialog" : (disabled ? " input-disable " : "") + - " input-primary " + - " input-dialog " + " input-primary input-dialog" } > {myValue !== "" ? myValue : "Type your prompt here"} diff --git a/src/frontend/src/components/textAreaComponent/index.tsx b/src/frontend/src/components/textAreaComponent/index.tsx index a50969cfb..d8121f5fb 100644 --- a/src/frontend/src/components/textAreaComponent/index.tsx +++ b/src/frontend/src/components/textAreaComponent/index.tsx @@ -27,13 +27,8 @@ export default function TextAreaComponent({ }, [closePopUp]); return ( -
-
+
+