import { useNavigate } from 'react-router-dom';

import { IconPlus } from '@material-hu/icons/tabler';
import Stack from '@material-hu/mui/Stack';
import Typography from '@material-hu/mui/Typography';

import Button from '@material-hu/components/design-system/Buttons/Button';

import { useLokaliseTranslation } from 'src/utils/i18n';

import usePathsTitle from '../../hooks/usePathsTitle';
import { pathsRoutes } from '../../routes';

const PathsHeader = () => {
  const { t } = useLokaliseTranslation('learning');
  const navigate = useNavigate();

  const titleLong = usePathsTitle('learning:path.title_long');

  const handleCreatePath = () => navigate(pathsRoutes.new());

  return (
    <Stack
      sx={{
        justifyContent: 'space-between',
        alignItems: 'center',
        flexDirection: 'row',
      }}
    >
      <Typography
        variant="globalL"
        fontWeight="fontWeightSemiBold"
      >
        {titleLong}
      </Typography>
      <Button
        variant="primary"
        startIcon={<IconPlus />}
        onClick={handleCreatePath}
      >
        {t('path.create')}
      </Button>
    </Stack>
  );
};

export default PathsHeader;
