import { ApolloProvider } from "@apollo/client";
import { ConfigProvider } from "antd";
import enLocale from "antd/es/locale/en_US";
import LogRocket from "logrocket";
import moment from "moment";
import React from "react";
import { useTranslation } from "react-i18next";
import GlobalLoadingBar from "../components/global-loading-bar/global-loading-bar.component";
import client from "../utils/GraphQLClient";
import App from "./App";
moment.locale("en-US");

if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");

export default function AppContainer() {
  const { t } = useTranslation();

  return (
    <ApolloProvider client={client}>
      <ConfigProvider
        //componentSize="small"
        input={{ autoComplete: "new-password" }}
        locale={enLocale}
        form={{
          validateMessages: {
            // eslint-disable-next-line no-template-curly-in-string
            required: t("general.validation.required", { label: "${label}" }),
          },
        }}
      >
        <GlobalLoadingBar />
        <App />
      </ConfigProvider>
    </ApolloProvider>
  );
}
