Data parsed through drop event fixed, data showing at node

This commit is contained in:
Lucas Oliveira 2023-02-14 18:10:27 -03:00
commit 30466ade93
3 changed files with 22 additions and 44 deletions

View file

@ -9,10 +9,10 @@ import Dropdown from "../../components/dropdownComponent";
import Input from "../../components/inputComponent";
import { nodeColors, nodeIcons } from "../../utils";
export default function GenericNode({ data, onDelete, onRun }) {
export default function GenericNode({ data }) {
const Icon = nodeIcons[data.type];
return (
<div className="prompt-node relative bg-white h-96 w-96 rounded-lg solid border flex flex-col justify-center">
<div className="prompt-node relative bg-white w-96 rounded-lg solid border flex flex-col justify-center">
<Handle
type="source"
position={Position.Left}
@ -32,21 +32,21 @@ export default function GenericNode({ data, onDelete, onRun }) {
<div className="w-full p-5 h-full">
<div className="w-full text-gray-500 text-sm truncate">
{data.description}
{data.node.description}
</div>
{data.template.map((t) => (
<div className="w-full mt-5">
{t.type === "dropdown" ? (
{Object.keys(data.node.template).map((t, idx) => (
<div key={idx} className="w-full mt-5">
{data.node.template[t].type === "dropdown" ? (
<Dropdown
title={t.title}
value={t.options[0]}
options={t.options}
title={data.node.template[t].title}
value={data.node.template[t].options[0]}
options={data.node.template[t].options}
onSelect={() => {}}
/>
) : t.type === "input" ? (
) : data.node.template[t].type === "str" ? (
<Input
title={t.title}
placeholder={t.placeholder}
title={t}
placeholder="pleicerolder"
onChange={() => {}}
/>
) : (
@ -58,10 +58,10 @@ export default function GenericNode({ data, onDelete, onRun }) {
</div>
<div className="flex w-full justify-between items-center bg-gray-50 gap-2 border-t text-gray-600 p-4 text-sm">
<button onClick={onDelete}>
<button onClick={data.onDelete}>
<TrashIcon className="w-6 h-6"></TrashIcon>
</button>
<button onClick={onRun}>
<button onClick={data.onRun}>
<PlayIcon className="w-6 h-6"></PlayIcon>
</button>
</div>