import { IconAward } from '@material-hu/icons/tabler';

import HuSidebarNavItem from '@material-hu/components/design-system/Sidebar/components/NavItem';

import { recognitionsRoutes } from 'src/pages/dashboard/recognitions/routes';
import { useLokaliseTranslation } from 'src/utils/i18n';

import itemsConfig from '../constants';
import { SidebarItemProps } from '../types';
import { getItemIsActive } from '../utils';

const { key, titleTranslationKey } = itemsConfig.recognitionsNemak;

const PATH = recognitionsRoutes.home();

const NavNemakRecognitionsItem = (props: SidebarItemProps) => {
  const { isCollapsed, onClick, isActive: isActiveProp } = props;

  const { t } = useLokaliseTranslation('dashboard_sidebar_app');
  const isActive = isActiveProp ?? getItemIsActive(PATH);
  return (
    <HuSidebarNavItem
      key={key}
      depth={0}
      title={t(titleTranslationKey)}
      icon={<IconAward />}
      path={PATH}
      isCollapsed={isCollapsed}
      onClick={onClick}
      active={isActive}
    />
  );
};

export default NavNemakRecognitionsItem;
