import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter as Router } from 'react-router-dom';

import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
import store, { persistor } from '@/store';

import { ConfigProvider } from 'antd';
import zhCN from 'antd/locale/zh_CN';

// import 'dayjs/locale/zh-cn';
// import dayjs from 'dayjs';
// // 汉化
// dayjs.locale('zh-cn');

import App from './App.jsx';

import { GlobalProvider } from './layout/GlobalContext.jsx';

import 'dayjs/locale/zh-cn';

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistor}>
        <ConfigProvider
          locale={zhCN}
          theme={{
            token: {
              colorPrimary: '#ab1941',
            },
          }}
        >
          <Router>
            <GlobalProvider>
              <App />
            </GlobalProvider>
          </Router>
        </ConfigProvider>
      </PersistGate>
    </Provider>
  </React.StrictMode>,
);
