import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import "fontsource-roboto";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { AppApolloClientProvider } from "./commons/graphql/client";
import { MuiPickersUtilsProvider } from "@material-ui/pickers";
import DateFnsUtils from "@date-io/date-fns";
import zhLocale from "date-fns/locale/zh-CN";
import { ConfirmProvider } from "material-ui-confirm";
import { SnackbarProvider } from "notistack";
import Router from "./commons/route/router";
import { AuthProvider } from "./commons/auth/auth.provider";

ReactDOM.render(
  <React.StrictMode>
    <ConfirmProvider>
      <SnackbarProvider maxSnack={5}>
        <AuthProvider>
          <AppApolloClientProvider>
            <MuiPickersUtilsProvider utils={DateFnsUtils} locale={zhLocale}>
              <Router>
                <App />
              </Router>
            </MuiPickersUtilsProvider>
          </AppApolloClientProvider>
        </AuthProvider>
      </SnackbarProvider>
    </ConfirmProvider>
  </React.StrictMode>,
  document.getElementById("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();
