|
|
|
@ -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<HTMLDivElement>(null); |
|
|
|
|
const [isOpen, setIsOpen] = useState(false); |
|
|
|
|
const [showUpgradeModal, setShowUpgradeModal] = useState(false); |
|
|
|
|
|
|
|
|
|
const { data: limits, isLoading } = useQuery( |
|
|
|
|
getAiCourseLimitOptions(), |
|
|
|
@ -45,6 +47,7 @@ export function AICourseLimit() { |
|
|
|
|
const followUpPercentage = Math.round((followUpUsed / followUpLimit) * 100); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<div className="relative z-10" ref={containerRef}> |
|
|
|
|
<button |
|
|
|
|
className="flex h-full cursor-pointer items-center rounded-lg border border-gray-200 px-2 py-1.5 text-sm hover:bg-gray-50" |
|
|
|
@ -120,5 +123,17 @@ export function AICourseLimit() { |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<button |
|
|
|
|
className="ml-2 rounded-md border border-gray-200 px-2 py-1 text-sm hover:bg-gray-50" |
|
|
|
|
onClick={() => setShowUpgradeModal(true)} |
|
|
|
|
> |
|
|
|
|
Upgrade |
|
|
|
|
</button> |
|
|
|
|
|
|
|
|
|
{showUpgradeModal && ( |
|
|
|
|
<UpgradeAccountModal onClose={() => setShowUpgradeModal(false)} /> |
|
|
|
|
)} |
|
|
|
|
</> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|