diff --git a/src/components/modals/EditSchemaDescriptionModal.tsx b/src/components/modals/EditSchemaDescriptionModal.tsx new file mode 100644 index 0000000..d219cec --- /dev/null +++ b/src/components/modals/EditSchemaDescriptionModal.tsx @@ -0,0 +1,60 @@ +import { Button, Form, Modal, Typography } from 'antd'; +import React, { useCallback, useRef } from 'react'; +import TextArea from 'antd/es/input/TextArea'; +import { UpdateSchemaMutationParams } from '../../hooks/schemas'; + +interface EditSchemaDescriptionModalProps { + open: boolean; + schema: UpdateSchemaMutationParams; + closeModal: () => void; + onSubmit: (comment: UpdateSchemaMutationParams) => void; + loading: boolean; +} + +export function EditSchemaDescriptionModal({ + open, + schema, + closeModal, + onSubmit, + loading, +}: EditSchemaDescriptionModalProps) { + const submitRef = useRef(null); + + const handleSubmit = useCallback(() => { + submitRef.current?.click(); + }, []); + + return ( + Edit description} + okText="Save" + cancelText="Cancel" + open={open} + destroyOnClose + onCancel={closeModal} + onOk={handleSubmit} + okButtonProps={{ loading: loading }} + > + + Schema description + + + layout="vertical" + onFinish={(values) => { + onSubmit(values); + }} + name="Edit description form" + initialValues={{ comment: schema.comment }} + > + +