diff --git a/src/components/GenerateRoadmap/GenerateRoadmap.tsx b/src/components/GenerateRoadmap/GenerateRoadmap.tsx index e935e3a07..fae9ea50f 100644 --- a/src/components/GenerateRoadmap/GenerateRoadmap.tsx +++ b/src/components/GenerateRoadmap/GenerateRoadmap.tsx @@ -106,6 +106,7 @@ export function GenerateRoadmap() { const openAPIKey = getOpenAIKey(); const isKeyOnly = IS_KEY_ONLY_ROADMAP_GENERATION; + const isAuthenticatedUser = isLoggedIn(); const renderRoadmap = async (roadmap: string) => { const { nodes, edges } = generateAIRoadmapFromText(roadmap); @@ -249,6 +250,11 @@ export function GenerateRoadmap() { }; const downloadGeneratedRoadmapContent = async () => { + if (!isLoggedIn()) { + showLoginPopup(); + return; + } + pageProgressMessage.set('Downloading Roadmap'); const node = document.getElementById('roadmap-container'); @@ -432,7 +438,7 @@ export function GenerateRoadmap() { {!isLoading && (
- {isKeyOnly && ( + {isKeyOnly && isAuthenticatedUser && (
{!openAPIKey && (

@@ -459,7 +465,7 @@ export function GenerateRoadmap() { )}

)} - {!isKeyOnly && ( + {!isKeyOnly && isAuthenticatedUser && (
{' '} roadmaps generated. - {!isLoggedInUser && ( - - )} - {isLoggedInUser && !openAPIKey && ( + {!openAPIKey && ( )} - {isLoggedInUser && openAPIKey && ( + {openAPIKey && (
)} + {!isAuthenticatedUser && ( + + )}
{ + if (!isAuthenticatedUser) { + e.preventDefault(); + showLoginPopup(); + } + }} disabled={ - !roadmapLimit || - !roadmapTerm || - roadmapLimitUsed >= roadmapLimit || - roadmapTerm === currentRoadmap?.term || - (isKeyOnly && !openAPIKey) + isAuthenticatedUser && + (!roadmapLimit || + !roadmapTerm || + roadmapLimitUsed >= roadmapLimit || + roadmapTerm === currentRoadmap?.term || + (isKeyOnly && !openAPIKey)) } > - {roadmapLimit > 0 && canGenerateMore && ( + {!isAuthenticatedUser && ( <> Generate )} - {roadmapLimit === 0 && Please wait..} + {isAuthenticatedUser && ( + <> + {roadmapLimit > 0 && canGenerateMore && ( + <> + + Generate + + )} - {roadmapLimit > 0 && !canGenerateMore && ( - - - Limit reached - + {roadmapLimit === 0 && Please wait..} + + {roadmapLimit > 0 && !canGenerateMore && ( + + + Limit reached + + )} + )}