import React from 'react';
import ReactDOM from 'react-dom';
import Router from './router'
import reportWebVitals from './reportWebVitals';

import { ConfigProvider } from 'antd'
import { AntIcon } from 'components'
import { SETTING_KEY } from 'common/storage';
import zhCN from 'antd/lib/locale/zh_CN'
import moment from 'moment'
import 'moment/locale/zh-cn'

const SETTING = JSON.parse(window.localStorage.getItem(SETTING_KEY)) || {
  theme: 'default'
};

let imp

if (SETTING.theme === 'dark') {
  imp = import('./assets/style/dark/index.less')
} else {
  imp = import('./assets/style/default/index.less')
}

moment.locale('zh-cn')

//<React.StrictMode></React.StrictMode>

const root = document.getElementById('root')
root.style.opacity = 0

imp.then(() => {
  ReactDOM.render(
    <ConfigProvider
      locale={zhCN}
      renderEmpty={
        () => (
          <div className="text-center pt-md">
            <AntIcon className="h3 mb-md" type="smile" />
            <p>暂无数据</p>
          </div>
        )
      }
    >
      <Router />
    </ConfigProvider>,
    root
  );

  // If you want to start measuring performance in your app, pass a function
  // to log results (for example: reportWebVitals(console.log))
  // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
  reportWebVitals();
})