diff --git a/src/components/AITutor/AIExploreCourseListing.tsx b/src/components/AITutor/AIExploreCourseListing.tsx
index 93ea36f46..c8b25f560 100644
--- a/src/components/AITutor/AIExploreCourseListing.tsx
+++ b/src/components/AITutor/AIExploreCourseListing.tsx
@@ -2,9 +2,13 @@ import { useListExploreAiCourses } from '../../queries/ai-course';
import { useEffect, useState } from 'react';
import { AlertCircle, Loader2 } from 'lucide-react';
import { AICourseCard } from '../GenerateCourse/AICourseCard';
+import { AILoadingState } from './AILoadingState';
+import { AITutorHeader } from './AITutorHeader';
+import { UpgradeAccountModal } from '../Billing/UpgradeAccountModal';
export function AIExploreCourseListing() {
const [isInitialLoading, setIsInitialLoading] = useState(true);
+ const [showUpgradePopup, setShowUpgradePopup] = useState(false);
const {
data,
@@ -23,50 +27,51 @@ export function AIExploreCourseListing() {
const courses = data?.pages.flatMap((page) => page.data) ?? [];
- return (
- <>
-
-
-
Explore Courses
-
+ if (isInitialLoading || isExploreAiCoursesLoading) {
+ return (
+
+ );
+ }
+
+ if (error) {
+ return (
+
+
+
+ {error?.message ?? 'Error loading courses.'}
+
+ );
+ }
- {(isExploreAiCoursesLoading || isInitialLoading) && (
-
+ return (
+ <>
+ {showUpgradePopup && (
+
setShowUpgradePopup(false)} />
)}
- {error && !isExploreAiCoursesLoading && !isInitialLoading && (
-
-
-
- {error?.message ?? 'Error loading courses.'}
-
+
setShowUpgradePopup(true)}
+ />
+
+ {courses && courses.length > 0 && (
+
+ {courses.map((course) => (
+
+ ))}
)}
- {!isExploreAiCoursesLoading &&
- courses &&
- courses.length > 0 &&
- !error && (
-
- {courses.map((course) => (
-
- ))}
-
- )}
-
- {hasNextPage && !isFetchingNextPage && !error && (
+ {hasNextPage && !isFetchingNextPage && (
)}
- {isFetchingNextPage && !error && (
+ {isFetchingNextPage && (
({
- perPage: '10',
+ perPage: '21',
currPage: '1',
query: '',
});
diff --git a/src/queries/ai-course.ts b/src/queries/ai-course.ts
index 4f90e2081..8b269124f 100644
--- a/src/queries/ai-course.ts
+++ b/src/queries/ai-course.ts
@@ -154,7 +154,7 @@ export function useListExploreAiCourses() {
return httpGet(
`/v1-list-explore-ai-courses`,
{
- perPage: '20',
+ perPage: '21',
currPage: String(pageParam),
},
);