import React from "react";
import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
import { DrawerButton, DrawerOption } from "../../Drawer.styled";
import { IconButton } from "../../../../Buttons/IconButton/IconButton";
import history from "../../../../../store/utils/history";
import { ADMIN_HOME_PAGE } from "../../../../../constants/pages";
import { SettingsIcon } from "./AdminPanelButton.styled";

const AdminPanelButton = (props) => {
  const { t } = useTranslation();
  const handleClick = () => {
    props.toggleDrawer();
    history.push(ADMIN_HOME_PAGE);
  };
  return (
    <DrawerButton onClick={handleClick}>
      <IconButton sx={{ borderRadius: "4px" }}>
        <SettingsIcon />
      </IconButton>
      <DrawerOption>{t("profile.adminPanel")}</DrawerOption>
    </DrawerButton>
  );
};

AdminPanelButton.propTypes = {
  toggleDrawer: PropTypes.func,
};

export default AdminPanelButton;
