|
|
|
@ -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 ( |
|
|
|
|
<div className="relative"> |
|
|
|
|
<button |
|
|
|
|
className="mt-4 flex w-full items-center gap-2 rounded-lg border border-yellow-300 bg-yellow-100 p-4 hover:bg-yellow-200" |
|
|
|
|
className="mt-4 flex w-full items-center gap-2 rounded-lg border border-yellow-300 bg-yellow-100 p-4 hover:bg-yellow-200 max-lg:mt-3 max-lg:text-sm" |
|
|
|
|
onClick={() => setIsOpen(true)} |
|
|
|
|
> |
|
|
|
|
<BotIcon className="h-4 w-4" /> |
|
|
|
|
<span>Still confused? Ask AI some follow up questions.</span> |
|
|
|
|
<span> |
|
|
|
|
<span className="max-sm:hidden">Still confused? </span> |
|
|
|
|
Ask AI some follow up questions |
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
<ArrowRightIcon className="ml-auto h-4 w-4" /> |
|
|
|
|
<ArrowRightIcon className="ml-auto h-4 w-4 max-sm:hidden" /> |
|
|
|
|
</button> |
|
|
|
|
|
|
|
|
|
{showUpgradeModal && ( |
|
|
|
|
<UpgradeAccountModal onClose={() => setShowUpgradeModal(false)} /> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
{isOpen && ( |
|
|
|
|
<AICourseFollowUpPopover |
|
|
|
|
courseSlug={courseSlug} |
|
|
|
@ -45,6 +55,10 @@ export function AICourseFollowUp(props: AICourseFollowUpProps) { |
|
|
|
|
lessonTitle={lessonTitle} |
|
|
|
|
courseAIChatHistory={courseAIChatHistory} |
|
|
|
|
setCourseAIChatHistory={setCourseAIChatHistory} |
|
|
|
|
onUpgradeClick={() => { |
|
|
|
|
setIsOpen(false); |
|
|
|
|
setShowUpgradeModal(true); |
|
|
|
|
}} |
|
|
|
|
onOutsideClick={() => { |
|
|
|
|
if (!isOpen) { |
|
|
|
|
return; |
|
|
|
|