import React, { useEffect } from "react";
import VehiclesPageComponent from "./vehicles.page.component";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";

import {
  setBreadcrumbs,
  setSelectedHeader,
} from "../../redux/application/application.actions";
const mapDispatchToProps = (dispatch) => ({
  setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
  setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
});

export function VehiclesPageContainer({ setBreadcrumbs, setSelectedHeader }) {
  const { t } = useTranslation();

  useEffect(() => {
    document.title = t("titles.vehicles");
    setSelectedHeader("vehicles");
    setBreadcrumbs([
      { link: "/manage/vehicles", label: t("titles.bc.vehicles") },
    ]);
  }, [t, setBreadcrumbs, setSelectedHeader]);

  return <VehiclesPageComponent />;
}
export default connect(null, mapDispatchToProps)(VehiclesPageContainer);
