import { Grid } from "../components/grid/Grid";
import { Box } from "@mui/material";
import { useLocation } from "react-router-dom";
import {
  ROUTE_PROVINCE_TRADING_PANEL,
  ROUTE_SLAUGHTER_TRADING_PANEL,
  ROUTE_ADMINX_TRADING_PANEL,
  ROUTE_SUPER_ADMIN_TRADING_PANEL,
} from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import { ProvinceTradePanel } from "../features/province/components/province-trade-panel/ProvinceTradePanel";
const TradePanel = () => {
  const { pathname } = useLocation();

  return (
    <Box display="flex" justifyContent="center">
      <Grid
        container
        direction="column"
        justifyContent="center"
        xs={12}
        sm={12}
        md={10}
        lg={10}
      >
        <BackButton />
        {(pathname === ROUTE_SLAUGHTER_TRADING_PANEL ||
          pathname === ROUTE_PROVINCE_TRADING_PANEL ||
          pathname === ROUTE_ADMINX_TRADING_PANEL ||
          pathname === ROUTE_SUPER_ADMIN_TRADING_PANEL) && (
          <ProvinceTradePanel />
        )}
      </Grid>
    </Box>
  );
};

export default TradePanel;
