/* eslint-disable */
import '!file-loader?name=[name].[ext]!./images/favicon.ico';
import './global.less';
import '@babel/polyfill';
import 'antd/dist/antd.less';
import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/extensions
import 'sanitize.css/sanitize.css';

import React from 'react';
import ReactDOM from 'react-dom';
import { ArcGISMap as MapComponent } from '@wisdom-map/arcgismap';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable';
import { Provider } from 'react-redux';

import configureStore from './configureStore';
import App from './containers/App';
import config from './routes/config';
import history from './utils/history';

const initialState = Immutable.Map();
const store = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('app');
const render = () => {
    ReactDOM.render(
      <Provider store = { store }>
        <ConnectedRouter history = { history }>
          <ConfigProvider locale = { zhCN } >
            { /* <PictureWallProvider> */ }
            <App routesConfig = { config }/>
            { /* </PictureWallProvider> */ }
          </ConfigProvider>
          </ConnectedRouter>
        </Provider>,
        MOUNT_NODE,
    );
};

if (module.hot) {
    module.hot.accept(['./containers/App'], () => {
        ReactDOM.unmountComponentAtNode(MOUNT_NODE);
        render();
    });
}
if (MOUNT_NODE) {
    render();
}

if (process.env.NODE_ENV === 'production') {
    require('offline-plugin/runtime').install(); // eslint-disable-line global-require
}