import 'react-contexify/ReactContexify.css';
import '@styles/index.css';
import {createRoot} from 'react-dom/client';
import {RouterProvider} from 'react-router-dom';
import {QueryClientProvider} from '@tanstack/react-query';
import {StrictMode, Suspense} from 'react';
import {QUERY_CLIENT} from '@utils';
import routes from '@routes';
import {ConfigProvider, ThemeConfig, App} from 'antd';
import {LDLoading} from '@components';
import antdZh from 'antd/locale/zh_CN';
import 'dayjs/locale/zh-cn';

const root = createRoot(document.getElementById('root')!);

const antdTheme: ThemeConfig = {
  token: {
    colorPrimary: '#1685a9',
    colorInfo: '#1685a9',
    colorInfoText: '#1685a9',
    colorPrimaryText: '#1685a9',
    colorLink: '#1685a9',
  },
};

root.render(
  <StrictMode>
    <Suspense fallback={<LDLoading tip="正在加载中" width="100vw" height="100vh" />}>
      <ConfigProvider theme={antdTheme} locale={antdZh}>
        <App>
          <QueryClientProvider client={QUERY_CLIENT}>
            <RouterProvider router={routes} />
          </QueryClientProvider>
        </App>
      </ConfigProvider>
    </Suspense>
  </StrictMode>,
);

