import EmptySpace from '@/components/EmptySpace';
import GlobalModalServicesProvider from '@/pages/GlobalModalServices/provider';
import { Outlet } from '@umijs/max';
import { App, ConfigProvider, theme } from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
import autofit from 'autofit.js';
import 'dayjs/locale/zh-cn';
import { useLayoutEffect } from 'react';
import styles from './index.less';
import MessageStore from './messageStore';
const Layouts = () => {
  useLayoutEffect(() => {
    autofit.init({
      dw: 3840,
      dh: 1080,
      el: 'body',
      resize: true,
      /** 禁止地图缩放，缩放会导致全部的地图点击事件不可用 */
      ignore: ['#customMap'],
    });
  }, []);
  //全局空文本占位图
  const customizeRenderEmpty = () => (
    <EmptySpace describe="暂无数据" style={{ padding: '10% 0' }} />
  );
  return (
    <div className={styles.app1} id="appWrap">
      <ConfigProvider
        locale={zhCN}
        renderEmpty={customizeRenderEmpty}
        theme={{
          algorithm: theme.darkAlgorithm,
        }}
      >
        <App
          message={{ maxCount: 1 }}
          style={{ width: '100%', height: '100%' }}
        >
          <MessageStore />
          <GlobalModalServicesProvider>
            <div className={styles.container}>
              <Outlet />
            </div>
          </GlobalModalServicesProvider>
        </App>
      </ConfigProvider>
    </div>
  );
};

export default Layouts;
