fix(IOInputField): remove console.log statement for inputType variable

fix(IOview): fix conditional rendering of IOInputField and IOOutputView components based on selectedCategory
This commit is contained in:
anovazzi1 2024-01-30 18:25:09 -03:00
commit 3c58007b62
2 changed files with 32 additions and 21 deletions

View file

@ -11,6 +11,7 @@ export default function IOInputField({
const nodes = useFlowStore((state) => state.nodes); const nodes = useFlowStore((state) => state.nodes);
const setNode = useFlowStore((state) => state.setNode); const setNode = useFlowStore((state) => state.setNode);
const node = nodes.find((node) => node.id === inputId); const node = nodes.find((node) => node.id === inputId);
console.log(inputType);
function handleInputType() { function handleInputType() {
if (!node) return "no node found"; if (!node) return "no node found";
switch (inputType) { switch (inputType) {
@ -30,7 +31,7 @@ export default function IOInputField({
}} }}
/> />
); );
case "fileLoader": case "FileLoader":
return ( return (
<IOFileInput <IOFileInput
field={node.data.node!.template["file_path"]["value"]} field={node.data.node!.template["file_path"]["value"]}

View file

@ -83,23 +83,24 @@ export default function IOView(): JSX.Element {
</button> </button>
); );
})} })}
{selectedView.type !== "ChatOutput" && ( {outputs.map((output) => output.type).includes("ChatOutput") &&
<button selectedView.type !== "ChatOutput" && (
onClick={() => setSelectedView({ type: "ChatOutput" })} <button
className={ onClick={() => setSelectedView({ type: "ChatOutput" })}
"cursor flex items-center rounded-md rounded-b-none px-1 hover:bg-muted-foreground" className={
} "cursor flex items-center rounded-md rounded-b-none px-1 hover:bg-muted-foreground"
key={"chat"} }
> key={"chat"}
<IconComponent >
name="Variable" <IconComponent
className=" file-component-variable" name="Variable"
/> className=" file-component-variable"
<span className="file-component-variables-span text-md"> />
Chat <span className="file-component-variables-span text-md">
</span> Chat
</button> </span>
)} </button>
)}
</div> </div>
{UpdateAccordion() {UpdateAccordion()
.filter((input) => input.type !== "ChatInput") .filter((input) => input.type !== "ChatInput")
@ -131,9 +132,18 @@ export default function IOView(): JSX.Element {
keyValue={input.id} keyValue={input.id}
> >
<div className="file-component-tab-column"> <div className="file-component-tab-column">
{node && ( {node &&
<IOInputField inputType={input.type} inputId={input.id} /> (selectedCategory === "Inputs" ? (
)} <IOInputField
inputType={input.type}
inputId={input.id}
/>
) : (
<IOOutputView
outputType={input.type}
outputId={input.id}
/>
))}
</div> </div>
</AccordionComponent> </AccordionComponent>
</div> </div>