From 0f8505cf9a5f765b43a30e4bb85a0b7f339a3b4b Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Wed, 18 Jun 2025 15:38:49 +0100 Subject: [PATCH] AI guide changes --- src/components/GenerateGuide/AIGuide.tsx | 11 ++++++++--- src/components/GenerateGuide/AIGuideChat.tsx | 9 ++++----- src/components/GenerateGuide/AIGuideContent.tsx | 12 ++++++------ src/components/LoadingChip.tsx | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/GenerateGuide/AIGuide.tsx b/src/components/GenerateGuide/AIGuide.tsx index ed7719d5a..1f839cf3a 100644 --- a/src/components/GenerateGuide/AIGuide.tsx +++ b/src/components/GenerateGuide/AIGuide.tsx @@ -31,7 +31,11 @@ export function AIGuide(props: AIGuideProps) { // only fetch the guide if the guideSlug is provided // otherwise we are still generating the guide - const { data: aiGuide } = useQuery(getAiGuideOptions(guideSlug), queryClient); + const { data: aiGuide, isLoading: isLoadingBySlug } = useQuery( + getAiGuideOptions(guideSlug), + queryClient, + ); + const { data: aiGuideSuggestions, isLoading: isAiGuideSuggestionsLoading } = useQuery( { @@ -88,9 +92,10 @@ export function AIGuide(props: AIGuideProps) { }); }; + console.log(isLoadingBySlug); return ( {showUpgradeModal && ( @@ -102,7 +107,7 @@ export function AIGuide(props: AIGuideProps) { )} {!guideSlug && } diff --git a/src/components/GenerateGuide/AIGuideChat.tsx b/src/components/GenerateGuide/AIGuideChat.tsx index 0207d0e4a..431832cc2 100644 --- a/src/components/GenerateGuide/AIGuideChat.tsx +++ b/src/components/GenerateGuide/AIGuideChat.tsx @@ -3,12 +3,10 @@ import { useChat, type ChatMessage } from '../../hooks/use-chat'; import { RoadmapAIChatCard } from '../RoadmapAIChat/RoadmapAIChatCard'; import { ArrowDownIcon, - BotIcon, - Loader2Icon, - LockIcon, + BotIcon, LockIcon, PauseCircleIcon, SendIcon, - Trash2Icon, + Trash2Icon } from 'lucide-react'; import { ChatHeaderButton } from '../FrameRenderer/RoadmapFloatingChat'; import { isLoggedIn } from '../../lib/jwt'; @@ -19,6 +17,7 @@ import { getAiCourseLimitOptions } from '../../queries/ai-course'; import { useQuery } from '@tanstack/react-query'; import { queryClient } from '../../stores/query-client'; import { billingDetailsOptions } from '../../queries/billing'; +import { LoadingChip } from '../LoadingChip'; type AIGuideChatProps = { guideSlug?: string; @@ -155,7 +154,7 @@ export function AIGuideChat(props: AIGuideChatProps) { {isLoading && (
- +
)} diff --git a/src/components/GenerateGuide/AIGuideContent.tsx b/src/components/GenerateGuide/AIGuideContent.tsx index 68999c384..00ac30750 100644 --- a/src/components/GenerateGuide/AIGuideContent.tsx +++ b/src/components/GenerateGuide/AIGuideContent.tsx @@ -6,17 +6,17 @@ import { LoadingChip } from '../LoadingChip'; type AIGuideContentProps = { html: string; onRegenerate?: (prompt?: string) => void; - isRegenerating?: boolean; + isLoading?: boolean; }; export function AIGuideContent(props: AIGuideContentProps) { - const { html, onRegenerate, isRegenerating } = props; + const { html, onRegenerate, isLoading } = props; return (
- {isRegenerating && !html && ( + {isLoading && !html && (
- +
)} - {onRegenerate && !isRegenerating && ( + {onRegenerate && !isLoading && (
diff --git a/src/components/LoadingChip.tsx b/src/components/LoadingChip.tsx index cb194df3c..72cbfb1ba 100644 --- a/src/components/LoadingChip.tsx +++ b/src/components/LoadingChip.tsx @@ -8,7 +8,7 @@ export function LoadingChip(props: LoadingChipProps) { const { message = 'Please wait...' } = props; return ( -
+
{message}