import React, { useMemo } from 'react' import AceEditor from 'react-ace' import obj2str from 'stringify-object' import useBearStore from '@/stores' import type { OperationDefinitionNodeGroupType } from '@/utils/operations' import { genArgsExample } from '@/utils/operations' import { printOneOperation } from '@/utils/printBatchOperations' import styles from './index.module.less' import type { FC } from 'react' interface IProps { isShow: boolean operationDefNode: OperationDefinitionNodeGroupType } const OperationStructure: FC = ({ isShow, operationDefNode }) => { const { isAllAddComment } = useBearStore(ste => ste) const remoteOperationArgsStr = useMemo(() => { return obj2str(genArgsExample(operationDefNode.args)) }, [operationDefNode.args]) const remoteOperationStr = useMemo(() => { return printOneOperation(operationDefNode, isAllAddComment) }, [isAllAddComment, operationDefNode]) const operationName = operationDefNode.name!.value const operationType = operationDefNode.operation return ( <>
Params:
{isShow && ( )}
<>
Response:
{isShow && ( )} ) } export default OperationStructure