import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { setBreadcrumbs } from "../../redux/application/application.actions";
import ManageRootPageComponent from "./manage-root.page.component";
import InstanceRenderManager from "../../utils/instanceRenderMgr";

const mapStateToProps = createStructuredSelector({});

const mapDispatchToProps = (dispatch) => ({
  setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs))
});

export function ManageRootPageContainer({ setBreadcrumbs }) {
  const { t } = useTranslation();
  useEffect(() => {
    document.title = t("titles.manageroot", {
      app: InstanceRenderManager({
        imex: "$t(titles.imexonline)",
        rome: "$t(titles.romeonline)"
      })
    });
    setBreadcrumbs([]);
  }, [t, setBreadcrumbs]);

  return <ManageRootPageComponent />;
}

export default connect(mapStateToProps, mapDispatchToProps)(ManageRootPageContainer);
