import type { FC } from 'react' import React from 'react' import type { NodeProps } from 'reactflow' import { useTranslation } from 'react-i18next' import { NodeTargetHandle } from '../_base/components/node-handle' import type { VariableAssignerNodeType } from './types' import { getNodeInfoById } from '@/app/components/workflow/nodes/_base/components/variable/var-reference-picker' import { VarBlockIcon } from '@/app/components/workflow/block-icon' import { Line3 } from '@/app/components/base/icons/src/public/common' import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development' const i18nPrefix = 'workflow.nodes.variableAssigner' const Node: FC> = (props) => { const { t } = useTranslation() const { data } = props const { variables, output_type } = data // TODO: get var type through node and value const getVarType = () => { return 'string' } return (
{t(`${i18nPrefix}.title`)}
{ variables.length === 0 && (
{t(`${i18nPrefix}.varNotSet`)}
) } {variables.length > 0 && ( <>
{variables.map((item, index) => { const node = getNodeInfoById([], item[0]) // TODO: can not get all nodes const varName = item[item.length - 1] return (
{node?.title}
{varName}
{getVarType()}
) }, )}
{t(`${i18nPrefix}.outputType`)}
{t(`${i18nPrefix}.type.${output_type}`)}
) }
) } export default React.memo(Node)