import { DragEvent } from 'react';
import { NodeType } from '../../../lib/canvas/schema';
import {
Box,
Cpu,
SlidersHorizontal,
FlaskConical,
Target,
ShieldAlert,
BrainCircuit,
Rocket,
} from 'lucide-react';
interface PaletteItem {
type: NodeType;
label: string;
icon: React.ReactNode;
description: string;
color: string;
}
const PALETTE_ITEMS: PaletteItem[] = [
{ type: 'model', label: 'Model', icon: , description: 'NX model file (.prt, .sim)', color: 'text-blue-400' },
{ type: 'solver', label: 'Solver', icon: , description: 'Nastran solution type', color: 'text-violet-400' },
{ type: 'designVar', label: 'Design Variable', icon: , description: 'Parameter to optimize', color: 'text-emerald-400' },
{ type: 'extractor', label: 'Extractor', icon: , description: 'Physics result extraction', color: 'text-cyan-400' },
{ type: 'objective', label: 'Objective', icon: , description: 'Optimization goal', color: 'text-rose-400' },
{ type: 'constraint', label: 'Constraint', icon: , description: 'Design constraint', color: 'text-amber-400' },
{ type: 'algorithm', label: 'Algorithm', icon: , description: 'Optimization method', color: 'text-indigo-400' },
{ type: 'surrogate', label: 'Surrogate', icon: , description: 'Neural acceleration', color: 'text-pink-400' },
];
export function NodePalette() {
const onDragStart = (event: DragEvent, nodeType: NodeType) => {
event.dataTransfer.setData('application/reactflow', nodeType);
event.dataTransfer.effectAllowed = 'move';
};
return (
Components
Drag to canvas
{PALETTE_ITEMS.map((item) => (
onDragStart(e, item.type)}
className="flex items-center gap-2.5 px-3 py-2.5 bg-dark-800/50 rounded-lg border border-dark-700/50
cursor-grab hover:border-primary-500/50 hover:bg-dark-800
active:cursor-grabbing transition-all group"
>
{item.icon}
{item.label}
{item.description}
))}
);
}