chore: Refactor ParameterComponent handle button rendering

This commit refactors the rendering of the handle button in the ParameterComponent. It improves the readability and maintainability of the code by simplifying the logic and removing unnecessary ternary operators.
This commit is contained in:
anovazzi1 2024-05-29 20:36:37 -03:00
commit 0ae9d8db6a
2 changed files with 25 additions and 21 deletions

View file

@ -258,28 +258,30 @@ export default function ParameterComponent({
<span className={!left && data.node?.frozen ? " text-ice" : ""}> <span className={!left && data.node?.frozen ? " text-ice" : ""}>
{title} {title}
</span> </span>
<ShadTooltip {!left && (
content={ <ShadTooltip
displayOutputPreview content={
? "Inspect Output" displayOutputPreview
: "Please build the component first" ? "Inspect Output"
} : "Please build the component first"
> }
<button
disabled={!displayOutputPreview}
onClick={() => setOpenOutputModal(true)}
> >
<IconComponent <button
className={classNames( disabled={!displayOutputPreview}
"h-5 w-5", onClick={() => setOpenOutputModal(true)}
displayOutputPreview >
? "" <IconComponent
: " cursor-not-allowed text-muted-foreground", className={classNames(
)} "h-5 w-5",
name={"Eye"} displayOutputPreview
/> ? ""
</button> : " cursor-not-allowed text-muted-foreground",
</ShadTooltip> )}
name={"ScanEye"}
/>
</button>
</ShadTooltip>
)}
</div> </div>
)} )}
<span className={(required ? "ml-2 " : "") + "text-status-red"}> <span className={(required ? "ml-2 " : "") + "text-status-red"}>

View file

@ -53,6 +53,7 @@ import {
FileType2, FileType2,
FileUp, FileUp,
FlaskConical, FlaskConical,
ScanEye,
FolderIcon, FolderIcon,
FolderPlus, FolderPlus,
FolderPlusIcon, FolderPlusIcon,
@ -397,6 +398,7 @@ export const nodeIconsLucide: iconsType = {
textsplitters: Scissors, textsplitters: Scissors,
wrappers: Gift, wrappers: Gift,
helpers: Wand2, helpers: Wand2,
ScanEye,
experimental: FlaskConical, experimental: FlaskConical,
langchain_utilities: PocketKnife, langchain_utilities: PocketKnife,
WolframAlphaAPIWrapper: SvgWolfram, WolframAlphaAPIWrapper: SvgWolfram,