diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx index 1b413b44f1..f56ad7ed3d 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx @@ -1,10 +1,7 @@ import React from 'react' import { useTranslation } from 'react-i18next' -import { - RiAddLine, -} from '@remixicon/react' import Tooltip from '@/app/components/base/tooltip' -import ActionButton from '@/app/components/base/action-button' +import MethodSelector from './method-selector' const i18nPrefix = 'workflow.nodes.humanInput' @@ -21,11 +18,9 @@ const DeliveryMethod: React.FC = () => { />
- { /* Add new user action logic here */ }} - > - - + { /* Add edit action logic here */ }} + />
{t(`${i18nPrefix}.deliveryMethod.emptyTip`)}
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx new file mode 100644 index 0000000000..d9d471fb4a --- /dev/null +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx @@ -0,0 +1,83 @@ +'use client' +import type { FC } from 'react' +import React, { useCallback, useRef, useState } from 'react' +import { useTranslation } from 'react-i18next' +import { + RiAddLine, + RiMailSendFill, + RiRobot2Fill, +} from '@remixicon/react' +import ActionButton from '@/app/components/base/action-button' +import { + PortalToFollowElem, + PortalToFollowElemContent, + PortalToFollowElemTrigger, +} from '@/app/components/base/portal-to-follow-elem' +import cn from '@/utils/classnames' + +const i18nPrefix = 'workflow.nodes.humanInput' + +type Props = { + onEdit: () => void +} + +const MethodSelector: FC = ({ + onEdit, +}) => { + const { t } = useTranslation() + const [open, doSetOpen] = useState(false) + const openRef = useRef(open) + const setOpen = useCallback((v: boolean) => { + doSetOpen(v) + openRef.current = v + }, [doSetOpen]) + + const handleTrigger = useCallback(() => { + setOpen(!openRef.current) + }, [setOpen]) + + return ( + + +
+ + + +
+
+ +
+
+
+
+ +
+
+
{t(`${i18nPrefix}.deliveryMethod.types.webapp.title`)}
+
{t(`${i18nPrefix}.deliveryMethod.types.webapp.description`)}
+
+
+
+
+ +
+
+
{t(`${i18nPrefix}.deliveryMethod.types.email.title`)}
+
{t(`${i18nPrefix}.deliveryMethod.types.email.description`)}
+
+
+
+
+
+
+ ) +} +export default React.memo(MethodSelector) diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index a8c17d3133..78193837c0 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -909,6 +909,21 @@ const translation = { title: 'Delivery Method', tooltip: 'How the human input form is delivered to the user.', emptyTip: 'No delivery method added, the operation cannot be triggered.', + types: { + webapp: { + title: 'Webapp', + description: 'Display to end-user in webapp', + }, + email: { + title: 'Email', + description: 'Send request for input via email', + }, + slack: { + title: 'Slack', + description: 'Send request for input via Slack', + }, + }, + added: 'Added', }, formContent: 'form content', userActions: { diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 61e30f5895..9da53528f5 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -910,6 +910,21 @@ const translation = { title: '提交方式', tooltip: '人类输入表单如何传递给用户。', emptyTip: '未添加提交方式,无法触发操作。', + types: { + webapp: { + title: 'Webapp', + description: '在 Web 应用中显示给最终用户', + }, + email: { + title: 'Email', + description: '通过电子邮件发送输入请求', + }, + slack: { + title: 'Slack', + description: '通过 Slack 发送输入请求', + }, + }, + added: '已添加', }, formContent: '表单内容', userActions: {