import React from "react";
import { useLocation } from "react-router-dom";
import { Grid } from "../../../../components/grid/Grid";
import { SPACING } from "../../../../data/spacing";
import { NavLink } from "../../../../components/nav-link/NavLink";
import LinkItem from "../../../../components/link-item/LinkItem";
import AcUnitIcon from "@mui/icons-material/AcUnit";
import {
  ROUTE_ADMINX_COLD_HOUSES_MANAGEMENT,
  ROUTE_PROVINCE_COLD_HOUSES_MANAGEMENT,
  ROUTE_SUPER_ADMIN_COLD_HOUSES_MANAGEMENT,
} from "../../../../routes/routes";
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";

export const ProvinceColdHousesOperations = () => {
  const { pathname } = useLocation();

  return (
    <Grid
      container
      gap={SPACING.SMALL}
      p={SPACING.SMALL}
      direction={{ xs: "column", md: "row" }}
      justifyContent="center"
      style={{ placeContent: "baseline" }}
    >
      <Grid container direction="column" style={{ width: "100%" }}>
        <Grid container gap={SPACING.SMALL} justifyContent="center">
          <NavLink
            to={
              getRoleFromUrl() === "ProvinceOperator"
                ? ROUTE_PROVINCE_COLD_HOUSES_MANAGEMENT
                : getRoleFromUrl() === "AdminX"
                ? ROUTE_ADMINX_COLD_HOUSES_MANAGEMENT
                : ROUTE_SUPER_ADMIN_COLD_HOUSES_MANAGEMENT
            }
            active={
              pathname === ROUTE_PROVINCE_COLD_HOUSES_MANAGEMENT ? "true" : null
            }
          >
            <LinkItem
              icon={<AcUnitIcon size={30} color="#244CCC" />}
              title="سردخانه ها"
              description="سردخانه ها"
            />
          </NavLink>
        </Grid>
      </Grid>
    </Grid>
  );
};
