Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
refactor: 统一Hands系统常量到单个源文件 refactor: 更新Hands中文名称和描述 fix: 修复技能市场在连接状态变化时重新加载 fix: 修复身份变更提案的错误处理逻辑 docs: 更新多个功能文档的验证状态和实现位置 docs: 更新Hands系统文档 test: 添加测试文件验证工作区路径
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
/**
|
|
* Input Node Component
|
|
*
|
|
* Node for defining workflow input variables.
|
|
*/
|
|
|
|
import React, { memo } from 'react';
|
|
import { Handle, Position, NodeProps } from '@xyflow/react';
|
|
import type { InputNodeData } from '../../../lib/workflow-builder/types';
|
|
|
|
export const InputNode = memo(({ data, selected }: NodeProps<InputNodeData>) => {
|
|
return (
|
|
<div
|
|
className={`
|
|
px-4 py-3 rounded-lg border-2 min-w-[180px]
|
|
bg-emerald-50 border-emerald-300
|
|
${selected ? 'border-emerald-500 shadow-lg shadow-emerald-200' : ''}
|
|
`}
|
|
>
|
|
{/* Output Handle */}
|
|
<Handle
|
|
type="source"
|
|
position={Position.Right}
|
|
className="w-3 h-3 bg-emerald-500 border-2 border-white"
|
|
/>
|
|
|
|
{/* Header */}
|
|
<div className="flex items-center gap-2 mb-2">
|
|
<span className="text-lg">📥</span>
|
|
<span className="font-medium text-emerald-800">{data.label}</span>
|
|
</div>
|
|
|
|
{/* Variable Name */}
|
|
<div className="text-sm text-emerald-600">
|
|
<span className="font-mono bg-emerald-100 px-1.5 py-0.5 rounded">
|
|
{data.variableName}
|
|
</span>
|
|
</div>
|
|
|
|
{/* Default Value Indicator */}
|
|
{data.defaultValue !== undefined && (
|
|
<div className="text-xs text-emerald-500 mt-1">
|
|
default: {typeof data.defaultValue === 'string'
|
|
? `"${data.defaultValue}"`
|
|
: JSON.stringify(data.defaultValue)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
});
|
|
|
|
InputNode.displayName = 'InputNode';
|
|
|
|
export default InputNode;
|