import LogsViewer from '@/components/logs-viewer/index'; import { useIntl } from '@umijs/max'; import { Modal } from 'antd'; import React, { useEffect, useState } from 'react'; type ViewModalProps = { open: boolean; url: string; autoScroll?: boolean; onCancel: () => void; }; const ViewCodeModal: React.FC = (props) => { const { open, url, onCancel } = props || {}; const [modalSize, setModalSize] = useState({ width: 600, height: 420 }); const isFullScreenRef = React.useRef(false); const intl = useIntl(); const handleFullscreenToggle = () => { isFullScreenRef.current = !isFullScreenRef.current; setModalSize((size: any) => { return { width: size.width === 600 ? '100%' : 600, height: size.height === 420 ? 'calc(100vh - 86px)' : 420 }; }); }; useEffect(() => { if (open) { isFullScreenRef.current = false; setModalSize({ width: '100%', height: 'calc(100vh - 86px)' }); } }, [open]); return ( {' '} {intl.formatMessage({ id: 'common.button.viewlog' })} } open={open} centered={true} onCancel={onCancel} destroyOnClose={true} closeIcon={true} maskClosable={false} keyboard={true} styles={{ content: { borderRadius: 0 } }} width={modalSize.width} footer={null} > ); }; export default React.memo(ViewCodeModal);