This commit is contained in:
StyleZhang
2024-03-12 17:44:27 +08:00
parent 74bf6cd186
commit a5147a382d
7 changed files with 68 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import {
useState,
} from 'react'
import Textarea from 'rc-textarea'
import { useTranslation } from 'react-i18next'
type InputProps = {
value: string
@ -14,6 +15,8 @@ export const TitleInput = memo(({
value,
onChange,
}: InputProps) => {
const { t } = useTranslation()
return (
<input
value={value}
@ -23,7 +26,7 @@ export const TitleInput = memo(({
hover:bg-gray-50
focus:border-gray-300 focus:shadow-xs focus:bg-white caret-[#295EFF]
`}
placeholder='Add title...'
placeholder={t('workflow.common.addTitle') || ''}
/>
)
})
@ -33,6 +36,7 @@ export const DescriptionInput = memo(({
value,
onChange,
}: InputProps) => {
const { t } = useTranslation()
const [focus, setFocus] = useState(false)
const handleFocus = useCallback(() => {
setFocus(true)
@ -60,7 +64,7 @@ export const DescriptionInput = memo(({
appearance-none outline-none resize-none
placeholder:text-gray-400 caret-[#295EFF]
`}
placeholder='Add description...'
placeholder={t('workflow.common.addDescription') || ''}
autoSize
/>
</div>

View File

@ -43,7 +43,7 @@ const BaseNode: FC<BaseNodeProps> = ({
className={`
group relative w-[240px] bg-[#fcfdff] shadow-xs
border border-transparent rounded-[15px]
hover:shadow-lg
${!data._runningStatus && 'hover:shadow-lg'}
${data._runningStatus === NodeRunningStatus.Running && '!border-primary-500'}
${data._runningStatus === NodeRunningStatus.Succeeded && '!border-[#12B76A]'}
${data._runningStatus === NodeRunningStatus.Failed && '!border-[#F04438]'}

View File

@ -41,6 +41,8 @@ const BasePanel: FC<BasePanelProps> = ({
handleNodeDataUpdate,
} = useWorkflow()
const handleTitleChange = useCallback((title: string) => {
if (!title)
return
handleNodeDataUpdate({ id, data: { ...data, title } })
}, [handleNodeDataUpdate, id, data])
const handleDescriptionChange = useCallback((desc: string) => {