remove custom node

This commit is contained in:
2026-03-06 09:53:16 +01:00
parent fd3addb2cc
commit add0299a30
2 changed files with 2 additions and 35 deletions

View File

@@ -14,7 +14,6 @@ import ReactFlow, {
NodeChange,
EdgeChange,
} from 'reactflow'
import CustomNode from './components/CustomNode'
import ConfigNode from './components/ConfigNode'
import RenderingNode from './components/RenderingNode'
import FlowContext from './lib/flowContext'
@@ -56,7 +55,7 @@ export default function App() {
const [contextTarget, setContextTarget] = React.useState<null | { type: 'canvas' | 'node'; nodeId?: string; clientX: number; clientY: number }>(null)
const nodeTypes = React.useMemo(
() => ({ custom: CustomNode, config: ConfigNode, render: RenderingNode }),
() => ({ config: ConfigNode, render: RenderingNode }),
[]
)
@@ -107,7 +106,7 @@ export default function App() {
const id = genId()
const newNode: Node = {
id,
type: type === 'custom' ? 'custom' : type === 'config' ? 'config' : 'render',
type: type === 'config' ? 'config' : 'render',
position: { x: position.x, y: position.y },
data: type === 'config' ? { yaml: '# Enter YAML here\n', title: `config-${id}` } : {},
}
@@ -157,7 +156,6 @@ export default function App() {
<ContextMenuLabel>New Node</ContextMenuLabel>
<ContextMenuItem onSelect={() => createNode('config')}>Config</ContextMenuItem>
<ContextMenuItem onSelect={() => createNode('render')}>Renderer</ContextMenuItem>
<ContextMenuItem onSelect={() => createNode('custom')}>Custom</ContextMenuItem>
</ContextMenuGroup>
</>
)}

View File

@@ -1,31 +0,0 @@
import React from 'react'
import { Handle, Position } from 'reactflow'
export default function CustomNode({ data }: any) {
return (
<div className="p-3 rounded-lg bg-white shadow hover:shadow-md border border-gray-200 w-56">
<div className="flex items-center justify-between mb-2">
<div className="text-sm font-semibold">{data.label}</div>
<div className="text-xs text-gray-400">ID: {data?.id ?? ''}</div>
</div>
<div className="text-xs text-gray-500 mb-2">Custom content</div>
<div className="flex justify-between mt-2">
<Handle
type="target"
position={Position.Left}
id="a"
style={{ background: '#F97316', width: 12, height: 12, borderRadius: 3 }}
/>
<Handle
type="source"
position={Position.Right}
id="b"
style={{ background: '#10B981', width: 12, height: 12, borderRadius: 3 }}
/>
</div>
</div>
)
}