import type { FC } from 'react' import { useState } from 'react' import type { NodeProps } from 'reactflow' import { useTranslation } from 'react-i18next' import { NodeTargetHandle } from '../_base/components/node-handle' import { mockData } from './mock' 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 { variables: tempVar, output_type } = mockData const [variables, setVariables] = useState(tempVar) // 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]) const varName = item[item.length - 1] return (
{node?.title}
{varName}
{getVarType()}
) }, )}
{/* For test */}
{ setVariables([...variables, []]) }} >Add
{t(`${i18nPrefix}.outputType`)}
{t(`${i18nPrefix}.type.${output_type}`)}
) }
) } export default Node