diff --git a/src/components/Billing/UpgradeAccountModal.tsx b/src/components/Billing/UpgradeAccountModal.tsx index ba55b2a10..274bc7ab6 100644 --- a/src/components/Billing/UpgradeAccountModal.tsx +++ b/src/components/Billing/UpgradeAccountModal.tsx @@ -24,9 +24,13 @@ type CreateSubscriptionCheckoutSessionResponse = { checkoutUrl: string; }; -type UpgradeAccountModalProps = {}; +type UpgradeAccountModalProps = { + onClose: () => void; +}; export function UpgradeAccountModal(props: UpgradeAccountModalProps) { + const { onClose } = props; + const [selectedPlan, setSelectedPlan] = useState('month'); const [isUpdatingPlan, setIsUpdatingPlan] = useState(false); @@ -115,7 +119,7 @@ export function UpgradeAccountModal(props: UpgradeAccountModalProps) { return ( {}} + onClose={onClose} wrapperClassName="rounded-xl max-w-3xl w-full min-h-[540px]" bodyClassName="p-6" > diff --git a/src/components/GenerateCourse/AICourseLimit.tsx b/src/components/GenerateCourse/AICourseLimit.tsx index 02cb590f4..a2c3a633a 100644 --- a/src/components/GenerateCourse/AICourseLimit.tsx +++ b/src/components/GenerateCourse/AICourseLimit.tsx @@ -11,10 +11,12 @@ import { useState, useRef } from 'react'; import { getAiCourseLimitOptions } from '../../queries/ai-course'; import { queryClient } from '../../stores/query-client'; import { useOutsideClick } from '../../hooks/use-outside-click'; +import { UpgradeAccountModal } from '../Billing/UpgradeAccountModal'; export function AICourseLimit() { const containerRef = useRef(null); const [isOpen, setIsOpen] = useState(false); + const [showUpgradeModal, setShowUpgradeModal] = useState(false); const { data: limits, isLoading } = useQuery( getAiCourseLimitOptions(), @@ -45,80 +47,93 @@ export function AICourseLimit() { const followUpPercentage = Math.round((followUpUsed / followUpLimit) * 100); return ( -
- + <> +
+ + + {isOpen && ( +
+
+
+
+ + {courseUsed} of {courseLimit} courses used +
- {isOpen && ( -
-
-
-
- - {courseUsed} of {courseLimit} courses used +
-
-
+
+
+ + {lessonUsed} of {lessonLimit} lessons used +
-
-
- - {lessonUsed} of {lessonLimit} lessons used +
-
-
+
+
+ + {followUpUsed} of {followUpLimit} follow-ups used +
-
-
- - {followUpUsed} of {followUpLimit} follow-ups used +
+
-
+
+ + Limit resets every 24 hours
+ )} +
-
- - Limit resets every 24 hours -
-
+ + + {showUpgradeModal && ( + setShowUpgradeModal(false)} /> )} -
+ ); } diff --git a/src/components/GenerateCourse/GetAICourse.tsx b/src/components/GenerateCourse/GetAICourse.tsx index fa4f5174d..7c6651287 100644 --- a/src/components/GenerateCourse/GetAICourse.tsx +++ b/src/components/GenerateCourse/GetAICourse.tsx @@ -45,18 +45,15 @@ export function GetAICourse(props: GetAICourseProps) { }, [error]); return ( - <> - - - + ); }