import { ArrowUpRight, Ban, Cog, Telescope, Wand } from 'lucide-react'; import type { FormEvent } from 'react'; import { useEffect, useState } from 'react'; import { isLoggedIn } from '../../lib/jwt'; import { showLoginPopup } from '../../lib/popup'; import { cn } from '../../lib/classname.ts'; import { AITermSuggestionInput } from './AITermSuggestionInput.tsx'; import { IncreaseRoadmapLimit } from './IncreaseRoadmapLimit.tsx'; type RoadmapSearchProps = { roadmapTerm: string; setRoadmapTerm: (topic: string) => void; handleSubmit: (e: FormEvent) => void; loadAIRoadmapLimit: () => void; onLoadTerm: (topic: string) => void; limit: number; limitUsed: number; isKeyOnly: boolean; }; export function RoadmapSearch(props: RoadmapSearchProps) { const { roadmapTerm, setRoadmapTerm, handleSubmit, limit = 0, limitUsed = 0, onLoadTerm, loadAIRoadmapLimit, isKeyOnly, } = props; const canGenerateMore = limitUsed < limit; const [isConfiguring, setIsConfiguring] = useState(false); const [isAuthenticatedUser, setIsAuthenticatedUser] = useState(false); const [isLoadingResults, setIsLoadingResults] = useState(false); useEffect(() => { setIsAuthenticatedUser(isLoggedIn()); }, []); const randomTerms = ['OAuth', 'UI / UX', 'SRE', 'DevRel']; return (
{isConfiguring && ( { setIsConfiguring(false); loadAIRoadmapLimit(); }} /> )}

Generate roadmaps with AI AI Roadmap Generator

Enter a topic and let the AI generate a roadmap for you Enter a topic to generate a roadmap

{ if (limit > 0 && canGenerateMore) { handleSubmit(e); } else { e.preventDefault(); } }} className="flex w-full flex-col gap-2 sm:flex-row" > setRoadmapTerm(value)} placeholder="Enter a topic to generate a roadmap for" wrapperClassName="w-full" onSelect={(roadmapId, roadmapTitle) => { onLoadTerm(roadmapTitle); }} />
{randomTerms.map((term) => ( ))} Explore AI Roadmaps
{!isAuthenticatedUser && (

{' '} to start generating roadmaps. Or explore the ones made by the community.

Explore AI Generated Roadmaps Visit Official Roadmaps

)} {isKeyOnly && isAuthenticatedUser && (

We have hit the limit for AI roadmap generation. Please try again again later or{' '}

Explore AI Roadmaps Visit Official Roadmaps

)} {!isKeyOnly && limit > 0 && isAuthenticatedUser && (

You have generated{' '} {limitUsed} of {limit} {' '} roadmaps today.

{isAuthenticatedUser && (

)}
)}
); }