import { IModalManagerChildrenProps } from '@/components/modal-manager'; import { useTranslate } from '@/hooks/commonHooks'; import { useFetchFlowTemplates } from '@/hooks/flow-hooks'; import { useSelectItem } from '@/hooks/logicHooks'; import { UserOutlined } from '@ant-design/icons'; import { Avatar, Card, Flex, Form, Input, Modal, Space, Typography, } from 'antd'; import classNames from 'classnames'; import { useEffect } from 'react'; import styles from './index.less'; const { Title } = Typography; interface IProps extends Omit { loading: boolean; initialName: string; onOk: (name: string, templateId: string) => void; showModal?(): void; } const CreateFlowModal = ({ visible, hideModal, loading, initialName, onOk, }: IProps) => { const [form] = Form.useForm(); const { t } = useTranslate('common'); const { data: list } = useFetchFlowTemplates(); const { selectedId, handleItemClick } = useSelectItem(list?.at(0)?.id); type FieldType = { name?: string; }; const handleOk = async () => { const ret = await form.validateFields(); return onOk(ret.name, selectedId); }; useEffect(() => { if (visible) { form.setFieldValue('name', initialName); } }, [initialName, form, visible]); return (
label={{t('name')}} name="name" rules={[{ required: true, message: t('namePlaceholder') }]} > Choose from templates {list?.map((x) => ( } src={x.avatar} /> {x.title}

{x.description}

))}
); }; export default CreateFlowModal;