import React, { useEffect } from 'react';
import { NextPage } from 'next';
import { useTranslation } from 'react-i18next';

import Navbar from '../containers/Navbar';
import Sidebar from '../containers/Sidebar';
import Toolbar from '../containers/Toolbar';
import Placeholder from '../containers/Placeholder';
import PdfViewer from '../containers/PdfViewer';
import AutoSave from '../containers/AutoSave';
import Loading from '../containers/Loading';
import Embed from '../components/Embed';

const index: NextPage = () => {
  const { i18n } = useTranslation('', { useSuspense: false });

  useEffect(() => {
    i18n.changeLanguage(window.navigator.language);
  }, []);

  return (
    <>
      <Navbar />
      <Sidebar />
      <Toolbar />
      <Placeholder />
      <PdfViewer />
      <AutoSave />
      <Loading />
      <Embed />
    </>
  );
};

export default index;
