import HuAlert from '@material-hu/components/design-system/Alert';

import { MIN_COURSES_TO_CREATE_PATH } from 'src/pages/dashboard/Learning/Paths/constants';
import { useLokaliseTranslation } from 'src/utils/i18n';

const CoursesMinimumAlert = ({ coursesCount }: { coursesCount: number }) => {
  const { t } = useLokaliseTranslation('learning');

  const shouldShowAlert =
    coursesCount > 0 && coursesCount < MIN_COURSES_TO_CREATE_PATH;

  if (!shouldShowAlert) return null;

  return (
    <HuAlert
      severity="warning"
      title={t('path.courses.empty.title')}
      description={t('path.courses.minimum.description')}
    />
  );
};

export default CoursesMinimumAlert;
