Update roadmap title

feat/ai-autocomplete
Kamran Ahmed 8 months ago
parent 1e118bfb5f
commit 2e48ae1f1f
  1. 5
      src/components/GenerateRoadmap/GenerateRoadmap.tsx
  2. 2
      src/components/GenerateRoadmap/RoadmapSearch.tsx

@ -168,10 +168,13 @@ export function GenerateRoadmap() {
const roadmapId = result.match(ROADMAP_ID_REGEX)?.[1] || ''; const roadmapId = result.match(ROADMAP_ID_REGEX)?.[1] || '';
setUrlParams({ id: roadmapId }); setUrlParams({ id: roadmapId });
result = result.replace(ROADMAP_ID_REGEX, ''); result = result.replace(ROADMAP_ID_REGEX, '');
const roadmapTitle =
result.trim().split('\n')[0]?.replace('#', '')?.trim() || term;
setRoadmapTerm(roadmapTitle);
setCurrentRoadmap({ setCurrentRoadmap({
id: roadmapId, id: roadmapId,
term: roadmapTerm, term: roadmapTerm,
title: term, title: roadmapTitle,
data: result, data: result,
}); });
} }

@ -253,7 +253,7 @@ export function RoadmapSearch(props: RoadmapSearchProps) {
> >
{limitUsed} of {limit} {limitUsed} of {limit}
</span>{' '} </span>{' '}
roadmaps. roadmaps today.
</p> </p>
{isAuthenticatedUser && ( {isAuthenticatedUser && (
<p className="flex items-center text-sm"> <p className="flex items-center text-sm">

Loading…
Cancel
Save