Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import type { FC } from 'react'
  2. import React from 'react'
  3. import { useTranslation } from 'react-i18next'
  4. import InputVarTypeIcon from '../_base/components/input-var-type-icon'
  5. import type { StartNodeType } from './types'
  6. import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development'
  7. import type { NodeProps } from '@/app/components/workflow/types'
  8. const i18nPrefix = 'workflow.nodes.start'
  9. const Node: FC<NodeProps<StartNodeType>> = ({
  10. data,
  11. }) => {
  12. const { t } = useTranslation()
  13. const { variables } = data
  14. if (!variables.length)
  15. return null
  16. return (
  17. <div className='mb-1 px-3 py-1'>
  18. <div className='space-y-0.5'>
  19. {variables.map(variable => (
  20. <div key={variable.variable} className='flex h-6 items-center justify-between space-x-1 rounded-md bg-workflow-block-parma-bg px-1'>
  21. <div className='flex w-0 grow items-center space-x-1'>
  22. <Variable02 className='h-3.5 w-3.5 shrink-0 text-text-accent' />
  23. <span className='system-xs-regular w-0 grow truncate text-text-secondary'>{variable.variable}</span>
  24. </div>
  25. <div className='ml-1 flex items-center space-x-1'>
  26. {variable.required && <span className='system-2xs-regular-uppercase text-text-tertiary'>{t(`${i18nPrefix}.required`)}</span>}
  27. <InputVarTypeIcon type={variable.type} className='h-3 w-3 text-text-tertiary' />
  28. </div>
  29. </div>
  30. ))}
  31. </div>
  32. </div>
  33. )
  34. }
  35. export default React.memo(Node)