From e876b10f4d0f4240189b39504e5a0e7b28eedd96 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Sat, 8 Mar 2025 16:57:16 +0000 Subject: [PATCH] Add course upgrade button --- .../GenerateCourse/AICourseFollowUp.tsx | 20 +++++++++++-- .../AICourseFollowUpPopover.tsx | 29 ++++++++++--------- .../GenerateCourse/AICourseLimit.tsx | 2 +- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/components/GenerateCourse/AICourseFollowUp.tsx b/src/components/GenerateCourse/AICourseFollowUp.tsx index 98e92c7c6..9241ccdb2 100644 --- a/src/components/GenerateCourse/AICourseFollowUp.tsx +++ b/src/components/GenerateCourse/AICourseFollowUp.tsx @@ -4,6 +4,7 @@ import { AICourseFollowUpPopover, type AIChatHistoryType, } from './AICourseFollowUpPopover'; +import { UpgradeAccountModal } from '../Billing/UpgradeAccountModal'; type AICourseFollowUpProps = { courseSlug: string; @@ -15,6 +16,8 @@ export function AICourseFollowUp(props: AICourseFollowUpProps) { const { courseSlug, moduleTitle, lessonTitle } = props; const [isOpen, setIsOpen] = useState(false); + const [showUpgradeModal, setShowUpgradeModal] = useState(false); + const [courseAIChatHistory, setCourseAIChatHistory] = useState< AIChatHistoryType[] >([ @@ -29,15 +32,22 @@ export function AICourseFollowUp(props: AICourseFollowUpProps) { return (
+ {showUpgradeModal && ( + setShowUpgradeModal(false)} /> + )} + {isOpen && ( { + setIsOpen(false); + setShowUpgradeModal(true); + }} onOutsideClick={() => { if (!isOpen) { return; diff --git a/src/components/GenerateCourse/AICourseFollowUpPopover.tsx b/src/components/GenerateCourse/AICourseFollowUpPopover.tsx index cd2ef2df5..d1e84976f 100644 --- a/src/components/GenerateCourse/AICourseFollowUpPopover.tsx +++ b/src/components/GenerateCourse/AICourseFollowUpPopover.tsx @@ -1,14 +1,5 @@ import { useQuery } from '@tanstack/react-query'; -import { - BookOpen, - Bot, - Code, - GitCompare, - HelpCircle, - LockIcon, - MessageCircle, - Send, -} from 'lucide-react'; +import { BookOpen, Bot, Code, HelpCircle, LockIcon, Send } from 'lucide-react'; import { useEffect, useMemo, useRef, useState, type FormEvent } from 'react'; import { flushSync } from 'react-dom'; import { useOutsideClick } from '../../hooks/use-outside-click'; @@ -41,6 +32,7 @@ type AICourseFollowUpPopoverProps = { setCourseAIChatHistory: (value: AIChatHistoryType[]) => void; onOutsideClick?: () => void; + onUpgradeClick: () => void; }; export function AICourseFollowUpPopover(props: AICourseFollowUpPopoverProps) { @@ -49,6 +41,7 @@ export function AICourseFollowUpPopover(props: AICourseFollowUpPopoverProps) { moduleTitle, lessonTitle, onOutsideClick, + onUpgradeClick, courseAIChatHistory, setCourseAIChatHistory, @@ -205,7 +198,7 @@ export function AICourseFollowUpPopover(props: AICourseFollowUpPopoverProps) { return ( <> {isLimitExceeded && ( -
- -

You have reached the AI usage limit for today.

+
+ +

Limit reached for today

+
)}