diff --git a/src/components/AIChat/AIChat.tsx b/src/components/AIChat/AIChat.tsx index 0689b66bf..652206d56 100644 --- a/src/components/AIChat/AIChat.tsx +++ b/src/components/AIChat/AIChat.tsx @@ -32,7 +32,6 @@ import { import { RoadmapRecommendations } from '../RoadmapAIChat/RoadmapRecommendations'; import { AIChatCourse } from './AIChatCouse'; import { showLoginPopup } from '../../lib/popup'; -import { UpgradeAccountModal } from '../Billing/UpgradeAccountModal'; import { readChatStream } from '../../lib/chat'; import { chatHistoryOptions } from '../../queries/chat-history'; import { cn } from '../../lib/classname'; @@ -51,6 +50,7 @@ type AIChatProps = { messages?: RoadmapAIChatHistoryType[]; chatHistoryId?: string; setChatHistoryId?: (chatHistoryId: string) => void; + onUpgrade?: () => void; }; export function AIChat(props: AIChatProps) { @@ -58,6 +58,7 @@ export function AIChat(props: AIChatProps) { messages: defaultMessages, chatHistoryId: defaultChatHistoryId, setChatHistoryId: setDefaultChatHistoryId, + onUpgrade, } = props; const toast = useToast(); @@ -70,7 +71,6 @@ export function AIChat(props: AIChatProps) { RoadmapAIChatHistoryType[] >(defaultMessages ?? []); - const [showUpgradeModal, setShowUpgradeModal] = useState(false); const [isPersonalizedResponseFormOpen, setIsPersonalizedResponseFormOpen] = useState(false); const [isUploadResumeModalOpen, setIsUploadResumeModalOpen] = useState(false); @@ -128,7 +128,7 @@ export function AIChat(props: AIChatProps) { if (isLimitExceeded) { if (!isPaidUser) { - setShowUpgradeModal(true); + onUpgrade?.(); } toast.error('Limit reached for today. Please wait until tomorrow.'); @@ -342,7 +342,7 @@ export function AIChat(props: AIChatProps) { (index: number) => { if (isLimitExceeded) { if (!isPaidUser) { - setShowUpgradeModal(true); + onUpgrade?.(); } toast.error('Limit reached for today. Please wait until tomorrow.'); @@ -429,10 +429,6 @@ export function AIChat(props: AIChatProps) { /> )} - {showUpgradeModal && ( - setShowUpgradeModal(false)} /> - )} -
+ ); + + if (!isPaidUser) { + return ( +
+
{closeButton}
+ +
+ +

+ Upgrade to Pro to keep your chat history. +

+ +
+
+ ); + } + + return ( +
{isLoading && } {!isLoading && isError && } @@ -101,18 +145,11 @@ export function ListChatHistory(props: ListChatHistoryProps) {

Chat History

- + {closeButton}