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" : ""}>
{title}
</span>
<ShadTooltip
content={
displayOutputPreview
? "Inspect Output"
: "Please build the component first"
}
>
<button
disabled={!displayOutputPreview}
onClick={() => setOpenOutputModal(true)}
{!left && (
<ShadTooltip
content={
displayOutputPreview
? "Inspect Output"
: "Please build the component first"
}
>
<IconComponent
className={classNames(
"h-5 w-5",
displayOutputPreview
? ""
: " cursor-not-allowed text-muted-foreground",
)}
name={"Eye"}
/>
</button>
</ShadTooltip>
<button
disabled={!displayOutputPreview}
onClick={() => setOpenOutputModal(true)}
>
<IconComponent
className={classNames(
"h-5 w-5",
displayOutputPreview
? ""
: " cursor-not-allowed text-muted-foreground",
)}
name={"ScanEye"}
/>
</button>
</ShadTooltip>
)}
</div>
)}
<span className={(required ? "ml-2 " : "") + "text-status-red"}>

View file

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