import { memo, useMemo, } from 'react' import { useTranslation } from 'react-i18next' import cn from '@/utils/classnames' 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' import { BubbleX, Env } from '@/app/components/base/icons/src/vender/line/others' import Badge from '@/app/components/base/badge' import type { Node } from '@/app/components/workflow/types' type NodeVariableItemProps = { isEnv: boolean isChatVar: boolean node: Node varName: string writeMode?: string showBorder?: boolean className?: string isException?: boolean } const i18nPrefix = 'workflow.nodes.assigner' const NodeVariableItem = ({ isEnv, isChatVar, node, varName, writeMode, showBorder, className, isException, }: NodeVariableItemProps) => { const { t } = useTranslation() const VariableIcon = useMemo(() => { if (isEnv) { return ( ) } if (isChatVar) { return ( ) } return ( ) }, [isEnv, isChatVar, isException]) const VariableName = useMemo(() => { return (
{varName}
) }, [isEnv, isChatVar, varName, isException]) return (
{ node && ( <>
{node?.data.title}
) } {VariableIcon} {VariableName}
{writeMode && }
) } export default memo(NodeVariableItem)