wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import type { FC } from 'react'
import React from 'react'
import Tooltip from '@/app/components/base/tooltip'
import { RiAddCircleLine, RiDeleteBinLine, RiEditLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
 
type ActionsProps = {
  disableAddBtn: boolean
  onAddChildField: () => void
  onEdit: () => void
  onDelete: () => void
}
 
const Actions: FC<ActionsProps> = ({
  disableAddBtn,
  onAddChildField,
  onEdit,
  onDelete,
}) => {
  const { t } = useTranslation()
 
  return (
    <div className='flex items-center gap-x-0.5'>
      <Tooltip popupContent={t('workflow.nodes.llm.jsonSchema.addChildField')}>
        <button
          type='button'
          className='flex h-6 w-6 items-center justify-center rounded-md text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary disabled:cursor-not-allowed disabled:text-text-disabled'
          onClick={onAddChildField}
          disabled={disableAddBtn}
        >
          <RiAddCircleLine className='h-4 w-4'/>
        </button>
      </Tooltip>
      <Tooltip popupContent={t('common.operation.edit')}>
        <button
          type='button'
          className='flex h-6 w-6 items-center justify-center rounded-md text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary'
          onClick={onEdit}
        >
          <RiEditLine className='h-4 w-4' />
        </button>
      </Tooltip>
      <Tooltip popupContent={t('common.operation.remove')}>
        <button
          type='button'
          className='flex h-6 w-6 items-center justify-center rounded-md text-text-tertiary hover:bg-state-destructive-hover hover:text-text-destructive'
          onClick={onDelete}
        >
          <RiDeleteBinLine className='h-4 w-4' />
        </button>
      </Tooltip>
    </div>
  )
}
 
export default React.memo(Actions)