Implemented only one node with both types
This commit is contained in:
parent
876a691004
commit
369ce5feb5
2 changed files with 108 additions and 118 deletions
|
|
@ -46,17 +46,15 @@ export default function ParameterComponent({
|
|||
const { reactFlowInstance } = useContext(typesContext);
|
||||
let disabled =
|
||||
reactFlowInstance?.getEdges().some((e) => e.targetHandle === id) ?? false;
|
||||
let disabledSource =
|
||||
reactFlowInstance?.getEdges().some((e) => e.sourceHandle !== id && e.source === data.id) ?? false;
|
||||
const { save } = useContext(TabsContext);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className={"w-full flex flex-wrap justify-between items-center dark:text-white mt-1 px-5 py-2 " + (!left ? (disabledSource ? "bg-gray-100 dark:bg-gray-700 text-gray-500": "bg-gray-50 dark:bg-gray-800") : "bg-gray-50 dark:bg-gray-800")}
|
||||
className="w-full flex flex-wrap justify-between items-center bg-gray-50 dark:bg-gray-800 dark:text-white mt-1 px-5 py-2"
|
||||
>
|
||||
<>
|
||||
<div className="text-sm truncate">
|
||||
<div className={"text-sm truncate w-full " + (left ? "" : "text-end")}>
|
||||
{title}
|
||||
<span className="text-red-600">{required ? " *" : ""}</span>
|
||||
</div>
|
||||
|
|
@ -78,8 +76,8 @@ export default function ParameterComponent({
|
|||
isValidConnection(connection, reactFlowInstance)
|
||||
}
|
||||
className={classNames(
|
||||
left ? "-ml-0.5 " : ("-mr-0.5 " + (disabledSource ? "pointer-events-none border-gray-400 " : "")),
|
||||
"w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800",
|
||||
left ? "-ml-0.5 " : "-mr-0.5 ",
|
||||
"w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800"
|
||||
)}
|
||||
style={{
|
||||
borderColor: color,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export default function GenericNode({
|
|||
<div key={idx}>
|
||||
{idx === 0 ? (
|
||||
<div className="px-5 py-2 mt-2 dark:text-white text-center">
|
||||
Inputs:
|
||||
Inputs
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
|
|
@ -100,26 +100,18 @@ export default function GenericNode({
|
|||
)}
|
||||
</div>
|
||||
))}
|
||||
{data.node.base_classes.map((c, idx) => (
|
||||
<div key={idx}>
|
||||
{idx === 0 ? (
|
||||
<div className="px-5 py-2 mt-2 dark:text-white text-center">
|
||||
Outputs:
|
||||
Output
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
<ParameterComponent
|
||||
data={data}
|
||||
color={nodeColors[types[c]] ?? nodeColors.unknown}
|
||||
title={c}
|
||||
tooltipTitle={`Type: ${c}`}
|
||||
id={[data.type, data.id, c].join("|")}
|
||||
type={c}
|
||||
color={nodeColors[types[data.type]] ?? nodeColors.unknown}
|
||||
title={data.node.base_classes.join(" | ")}
|
||||
tooltipTitle={`Type: ${data.node.base_classes.join(" | ")}`}
|
||||
id={[data.type, data.id, ...data.node.base_classes].join("|")}
|
||||
type={data.node.base_classes.join("|")}
|
||||
left={false}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue