From dee4bec9c682aa5786aa8a72d0ec9f1520c668c4 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Tue, 18 Mar 2025 21:52:36 +0600 Subject: [PATCH] fix: only creator can mark progress --- .../GenerateCourse/AICourseContent.tsx | 11 ++++++++++- .../GenerateCourse/AICourseLesson.tsx | 17 +++++++++++++++-- .../GenerateCourse/GenerateAICourse.tsx | 3 +++ src/components/GenerateCourse/GetAICourse.tsx | 1 + 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/components/GenerateCourse/AICourseContent.tsx b/src/components/GenerateCourse/AICourseContent.tsx index 9e0c4564c..c03a6f473 100644 --- a/src/components/GenerateCourse/AICourseContent.tsx +++ b/src/components/GenerateCourse/AICourseContent.tsx @@ -22,6 +22,7 @@ import { AILimitsPopup } from './AILimitsPopup'; import { RegenerateOutline } from './RegenerateOutline'; type AICourseContentProps = { + courseCreatorId: string; courseSlug?: string; course: AiCourse; isLoading: boolean; @@ -30,7 +31,14 @@ type AICourseContentProps = { }; export function AICourseContent(props: AICourseContentProps) { - const { course, courseSlug, isLoading, error, onRegenerateOutline } = props; + const { + course, + courseSlug, + isLoading, + error, + onRegenerateOutline, + courseCreatorId, + } = props; const [showUpgradeModal, setShowUpgradeModal] = useState(false); const [showAILimitsPopup, setShowAILimitsPopup] = useState(false); @@ -382,6 +390,7 @@ export function AICourseContent(props: AICourseContentProps) { > {viewMode === 'module' && ( { + toast.error(error?.message || 'Something went wrong'); + }, }, queryClient, ); @@ -203,7 +212,9 @@ export function AICourseLesson(props: AICourseLessonProps) { isLoading; const cantGoBack = - (activeModuleIndex === 0 && activeLessonIndex === 0) || isGenerating || isLoading; + (activeModuleIndex === 0 && activeLessonIndex === 0) || + isGenerating || + isLoading; return (
@@ -231,7 +242,9 @@ export function AICourseLesson(props: AICourseLessonProps) { }} />