Commit 307cbf1d authored by Joel's avatar Joel

feat: input no var tip

parent e7ecdb01
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
import type { FC } from 'react' import type { FC } from 'react'
import React, { useCallback } from 'react' import React, { useCallback } from 'react'
import produce from 'immer' import produce from 'immer'
import { useTranslation } from 'react-i18next'
import VarItem from './var-item' import VarItem from './var-item'
import type { InputVar } from '@/app/components/workflow/types' import type { InputVar } from '@/app/components/workflow/types'
type Props = { type Props = {
readonly: boolean readonly: boolean
list: InputVar[] list: InputVar[]
...@@ -15,6 +17,8 @@ const VarList: FC<Props> = ({ ...@@ -15,6 +17,8 @@ const VarList: FC<Props> = ({
list, list,
onChange, onChange,
}) => { }) => {
const { t } = useTranslation()
const handleVarNameChange = useCallback((index: number) => { const handleVarNameChange = useCallback((index: number) => {
return (payload: InputVar) => { return (payload: InputVar) => {
const newList = produce(list, (draft) => { const newList = produce(list, (draft) => {
...@@ -33,6 +37,14 @@ const VarList: FC<Props> = ({ ...@@ -33,6 +37,14 @@ const VarList: FC<Props> = ({
} }
}, [list, onChange]) }, [list, onChange])
if (list.length === 0) {
return (
<div className='flex rounded-md bg-gray-50 items-center h-[42px] justify-center leading-[18px] text-xs font-normal text-gray-500'>
{t('workflow.nodes.start.noVarTip')}
</div>
)
}
return ( return (
<div className='space-y-1'> <div className='space-y-1'>
{list.map((item, index) => ( {list.map((item, index) => (
......
...@@ -17,6 +17,7 @@ const translation = { ...@@ -17,6 +17,7 @@ const translation = {
}, },
files: 'File list', files: 'File list',
}, },
noVarTip: 'Set inputs that can be used in the Workflow',
}, },
end: { end: {
outputs: 'Outputs', outputs: 'Outputs',
......
...@@ -16,6 +16,7 @@ const translation = { ...@@ -16,6 +16,7 @@ const translation = {
}, },
files: '文件列表', files: '文件列表',
}, },
noVarTip: '设置的输入可在工作流程中使用',
}, },
end: { end: {
outputs: '输出', outputs: '输出',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment