From c0df7d7467b64337ff9b5c93a4b13cbd82ee4f52 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 27 May 2025 01:59:22 +0100 Subject: [PATCH] Mobile window for roadmap chat --- .../RoadmapAIChat/RoadmapAIChat.tsx | 58 +++++++++++++++---- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/src/components/RoadmapAIChat/RoadmapAIChat.tsx b/src/components/RoadmapAIChat/RoadmapAIChat.tsx index 764cc90b2..0319166fd 100644 --- a/src/components/RoadmapAIChat/RoadmapAIChat.tsx +++ b/src/components/RoadmapAIChat/RoadmapAIChat.tsx @@ -12,6 +12,7 @@ import { useState, } from 'react'; import { + Bot, Frown, Loader2Icon, LockIcon, @@ -46,6 +47,7 @@ import { billingDetailsOptions } from '../../queries/billing'; import { TopicDetail } from '../TopicDetail/TopicDetail'; import { slugify } from '../../lib/slugger'; import { AIChatActionButtons } from './AIChatActionButtons'; +import { cn } from '../../lib/classname'; export type RoamdapAIChatHistoryType = { role: AllowedAIChatRole; @@ -75,6 +77,7 @@ export function RoadmapAIChat(props: RoadmapAIChatProps) { const editorRef = useRef(null); const scrollareaRef = useRef(null); + const [isChatMobileVisible, setIsChatMobileVisible] = useState(false); const [isLoading, setIsLoading] = useState(true); const [showUpgradeModal, setShowUpgradeModal] = useState(false); const [selectedTopicId, setSelectedTopicId] = useState(null); @@ -364,7 +367,6 @@ export function RoadmapAIChat(props: RoadmapAIChatProps) { userResourceProgressLoading || isTokenUsageLoading || isBillingDetailsLoading; - const hasChatHistory = aiChatHistory.length > 0; return (
@@ -380,20 +382,54 @@ export function RoadmapAIChat(props: RoadmapAIChatProps) { )} {roadmapDetail?.json && !isLoading && ( -
-
- -
+
+ + + {/* floating chat button */} + {!isChatMobileVisible && ( +
+ +
+ )}
)}
-
+ {isChatMobileVisible && ( +
{ + setIsChatMobileVisible(false); + }} + className="fixed inset-0 z-50 bg-black/50" + /> + )} + +