Moving next should be mark it as done

feat/ai-course-improvement
Kamran Ahmed 1 month ago
parent b17ba1b009
commit a82a0e6efb
  1. 29
      src/components/GenerateCourse/AICourseLesson.tsx

@ -334,9 +334,20 @@ export function AICourseLesson(props: AICourseLessonProps) {
Previous <span className="hidden lg:inline">&nbsp;Lesson</span> Previous <span className="hidden lg:inline">&nbsp;Lesson</span>
</button> </button>
<div>
<button <button
onClick={onGoToNextLesson} onClick={() => {
disabled={cantGoForward} if (!isLessonDone) {
toggleDone(undefined, {
onSuccess: () => {
onGoToNextLesson();
},
});
} else {
onGoToNextLesson();
}
}}
disabled={cantGoForward || isTogglingDone}
className={cn( className={cn(
'flex items-center rounded-full px-4 py-2 disabled:opacity-50 max-lg:px-3 max-lg:py-1.5 max-lg:text-sm', 'flex items-center rounded-full px-4 py-2 disabled:opacity-50 max-lg:px-3 max-lg:py-1.5 max-lg:text-sm',
cantGoForward cantGoForward
@ -344,11 +355,25 @@ export function AICourseLesson(props: AICourseLessonProps) {
: 'bg-gray-800 text-white hover:bg-gray-700', : 'bg-gray-800 text-white hover:bg-gray-700',
)} )}
> >
{isTogglingDone ? (
<>
<Loader2Icon
size={16}
strokeWidth={3}
className="animate-spin text-white"
/>
Please wait ...
</>
) : (
<>
Next <span className="hidden lg:inline">&nbsp;Lesson</span> Next <span className="hidden lg:inline">&nbsp;Lesson</span>
<ChevronRight size={16} className="ml-2" /> <ChevronRight size={16} className="ml-2" />
</>
)}
</button> </button>
</div> </div>
</div> </div>
</div>
{!isGenerating && !isLoading && ( {!isGenerating && !isLoading && (
<AICourseFollowUp <AICourseFollowUp

Loading…
Cancel
Save