import { Headphone } from "iconsax-react";
import { FC } from "react";
import { useTranslation } from "react-i18next";
import { useLocation } from "react-router-dom";
import { Pages } from "../../config/Pages";
import SubMenuItem from "./SubMenuItem";

const SupportSubMenu: FC = () => {
  const location = useLocation();
  const { t } = useTranslation("global");

  const isActive = (name: string) => location.pathname.includes(name);

  return (
    <div className="py-12">
      <div className="flex gap-3 items-center border-b pb-10 px-6">
        <Headphone
          size={24}
          color="#000"
          variant="Bold"
        />
        <div className="text-xs">{t("sidebar.support_section")}</div>
      </div>

      <div className="flex flex-col mt-10 gap-4">
        <SubMenuItem
          title={t("sidebar.support")}
          isActive={isActive("/support")}
          link={Pages.support.list}
          activeName="support_plan"
        />
        <SubMenuItem
          title={t("submenu.ticket_list")}
          isActive={isActive("/tickets/list") || isActive("/tickets/messages") || isActive("/tickets/create")}
          link={Pages.ticket.list}
          activeName="tickets"
        />
        <SubMenuItem
          title={t("submenu.ticket_category")}
          isActive={isActive("/tickets/category")}
          link={Pages.ticket.category}
          activeName="tickets"
        />
      </div>
    </div>
  );
};

export default SupportSubMenu;
