+
{shouldShowAiTab && (
Help us Improve this Content
diff --git a/src/components/TopicDetail/TopicDetailAI.tsx b/src/components/TopicDetail/TopicDetailAI.tsx
index 36b488eaa..32380fd7c 100644
--- a/src/components/TopicDetail/TopicDetailAI.tsx
+++ b/src/components/TopicDetail/TopicDetailAI.tsx
@@ -14,10 +14,11 @@ import { queryClient } from '../../stores/query-client';
import { isLoggedIn, removeAuthToken } from '../../lib/jwt';
import {
BotIcon,
+ Gift,
Loader2Icon,
LockIcon,
- RotateCcwIcon,
SendIcon,
+ Trash2
} from 'lucide-react';
import { showLoginPopup } from '../../lib/popup';
import { cn } from '../../lib/classname';
@@ -34,6 +35,7 @@ import type { ResourceType } from '../../lib/resource-progress';
import { getPercentage } from '../../lib/number';
import { roadmapTreeMappingOptions } from '../../queries/roadmap-tree';
import { defaultChatHistory } from './TopicDetail';
+import { AILimitsPopup } from '../GenerateCourse/AILimitsPopup';
type TopicDetailAIProps = {
resourceId: string;
@@ -67,7 +69,7 @@ export function TopicDetailAI(props: TopicDetailAIProps) {
const [message, setMessage] = useState('');
const [isStreamingMessage, setIsStreamingMessage] = useState(false);
const [streamedMessage, setStreamedMessage] = useState('');
-
+ const [showAILimitsPopup, setShowAILimitsPopup] = useState(false);
const { data: tokenUsage, isLoading } = useQuery(
getAiCourseLimitOptions(),
queryClient,
@@ -234,10 +236,20 @@ export function TopicDetailAI(props: TopicDetailAIProps) {
)}
+ {showAILimitsPopup && (
+
setShowAILimitsPopup(false)}
+ onUpgrade={() => {
+ setShowAILimitsPopup(false);
+ onUpgrade();
+ }}
+ />
+ )}
+
{hasSubjects && (
-
-
- Complete the following courses on AI Tutor
+
+
+ Complete the following AI Tutor courses
@@ -247,7 +259,7 @@ export function TopicDetailAI(props: TopicDetailAIProps) {
key={subject}
target="_blank"
href={`/ai/search?term=${subject}&difficulty=beginner&src=topic`}
- className="rounded-md border px-1.5"
+ className="flex items-center bg-gray-100 gap-1 gap-2 rounded-md border border-gray-300 px-2 py-1 hover:bg-gray-200 hover:text-black"
>
{subject}
@@ -259,13 +271,16 @@ export function TopicDetailAI(props: TopicDetailAIProps) {
{hasSubjects && (
-
- or start chatting with AI
+
+
+ Chat with AI
)}
@@ -280,29 +295,36 @@ export function TopicDetailAI(props: TopicDetailAIProps) {
)}
{!isDataLoading && (
-
+
{hasChatHistory && (
)}
{!isPaidUser && (
<>
+
-
- {usagePercentage}% used
-
>
)}
diff --git a/src/components/TopicDetail/TopicDetailsTabs.tsx b/src/components/TopicDetail/TopicDetailsTabs.tsx
index 3080337fd..6368a7753 100644
--- a/src/components/TopicDetail/TopicDetailsTabs.tsx
+++ b/src/components/TopicDetail/TopicDetailsTabs.tsx
@@ -42,16 +42,16 @@ function TopicDetailsTab(props: TopicDetailsTabProps) {
return (