diff --git a/src/components/nodes/BasicInfoNode.tsx b/src/components/nodes/BasicInfoNode.tsx new file mode 100644 index 0000000..082b614 --- /dev/null +++ b/src/components/nodes/BasicInfoNode.tsx @@ -0,0 +1,148 @@ +import { memo, useState } from 'react'; +import { Handle, Position } from '@xyflow/react'; +import type { NodeProps } from '@xyflow/react'; +import { Settings, ChevronDown, ChevronUp } from 'lucide-react'; +import type { BasicInfoNodeData } from '../../types/nodes'; + +export const BasicInfoNode = memo(({ data }: NodeProps) => { + const [isExpanded, setIsExpanded] = useState(true); + const nodeData = data as BasicInfoNodeData; + + const handleChange = (field: keyof BasicInfoNodeData, value: string | number | boolean | string[] | undefined | { width: number; height: number }) => { + // Update node data - in a real implementation, this would use a store or context + // For now, we'll use data mutation which React Flow handles + Object.assign(nodeData, { [field]: value }); + }; + + const handleNamesChange = (names: string) => { + handleChange('names', names.split(',').map(name => name.trim()).filter(name => name)); + }; + + const handleAspectsChange = (aspects: string) => { + handleChange('aspects', aspects ? aspects.split(',').map(aspect => aspect.trim()).filter(aspect => aspect) : undefined); + }; + + return ( +
+ {/* Node Header */} +
+
+ + Basic Info +
+ +
+ + {/* Node Content */} + {isExpanded && ( +
+
+ + handleChange('resourceIdentifier', e.target.value)} + className="w-full px-2 py-1 text-sm border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500" + placeholder="cobblemon:npc_name" + /> +
+ +
+ + handleNamesChange(e.target.value)} + className="w-full px-2 py-1 text-sm border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500" + placeholder="NPC Name 1, NPC Name 2" + /> +
+ +
+ + handleChange('modelScale', parseFloat(e.target.value))} + className="w-full px-2 py-1 text-sm border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500" + /> +
+ +
+ + handleAspectsChange(e.target.value)} + className="w-full px-2 py-1 text-sm border border-gray-300 rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500" + placeholder="aspect1, aspect2" + /> +
+ +
+
Behavior
+
+ + + + +
+
+
+ )} + + {/* Output Handle */} + +
+ ); +}); + +BasicInfoNode.displayName = 'BasicInfoNode';