import React, { 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 { selectBodyshop } from "../../redux/user/user.selectors";
import ManageRootPageComponent from "./manage-root.page.component";

const mapStateToProps = createStructuredSelector({
  bodyshop: selectBodyshop,
});

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

export function ManageRootPageContainer({ setBreadcrumbs, bodyshop }) {
  const { t } = useTranslation();
  useEffect(() => {
    document.title = t("titles.manageroot");
    setBreadcrumbs([]);
  }, [t, setBreadcrumbs]);

  return <ManageRootPageComponent />;
}
export default connect(
  mapStateToProps,
  mapDispatchToProps
)(ManageRootPageContainer);
