feat: add icon to title of operator form #918 (#1413)

### What problem does this PR solve?
feat: add icon to title of operator form #918


### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-07-08 12:32:46 +08:00
committed by GitHub
parent 0f597b9817
commit 1f967191d4
8 changed files with 31 additions and 12 deletions

View File

@ -1,5 +1,6 @@
import { useTranslate } from '@/hooks/commonHooks';
import { IModalProps } from '@/interfaces/common';
import { Drawer, Form, Input } from 'antd';
import { Drawer, Flex, Form, Input } from 'antd';
import { useEffect } from 'react';
import { Node } from 'reactflow';
import AnswerForm from '../answer-form';
@ -9,10 +10,13 @@ import { Operator } from '../constant';
import GenerateForm from '../generate-form';
import { useHandleFormValuesChange, useHandleNodeNameChange } from '../hooks';
import MessageForm from '../message-form';
import OperatorIcon from '../operator-icon';
import RelevantForm from '../relevant-form';
import RetrievalForm from '../retrieval-form';
import RewriteQuestionForm from '../rewrite-question-form';
import styles from './index.less';
interface IProps {
node?: Node;
}
@ -40,6 +44,7 @@ const FlowDrawer = ({
const [form] = Form.useForm();
const { name, handleNameBlur, handleNameChange } =
useHandleNodeNameChange(node);
const { t } = useTranslate('flow');
const { handleValuesChange } = useHandleFormValuesChange(node?.id);
@ -52,11 +57,19 @@ const FlowDrawer = ({
return (
<Drawer
title={
<Input
value={name}
onBlur={handleNameBlur}
onChange={handleNameChange}
></Input>
<Flex gap={'middle'} align="center">
<OperatorIcon name={operatorName}></OperatorIcon>
<Flex align="center" gap={'small'} flex={1}>
<label htmlFor="" className={styles.title}>
{t('title')}
</label>
<Input
value={name}
onBlur={handleNameBlur}
onChange={handleNameChange}
></Input>
</Flex>
</Flex>
}
placement="right"
onClose={hideModal}