diff --git a/src/components/AuthenticationFlow/EmailLoginForm.tsx b/src/components/AuthenticationFlow/EmailLoginForm.tsx index 8e7e2c0a3..d21637b60 100644 --- a/src/components/AuthenticationFlow/EmailLoginForm.tsx +++ b/src/components/AuthenticationFlow/EmailLoginForm.tsx @@ -2,8 +2,9 @@ import type { FormEvent } from 'react'; import { useId, useState } from 'react'; import { httpPost } from '../../lib/http'; import { - COURSE_PURCHASE_PARAM, FIRST_LOGIN_PARAM, - setAuthToken + COURSE_PURCHASE_PARAM, + FIRST_LOGIN_PARAM, + setAuthToken, } from '../../lib/jwt'; type EmailLoginFormProps = { diff --git a/src/components/AuthenticationFlow/LoginPopup.astro b/src/components/AuthenticationFlow/LoginPopup.astro index 04e19360e..25ef117b3 100644 --- a/src/components/AuthenticationFlow/LoginPopup.astro +++ b/src/components/AuthenticationFlow/LoginPopup.astro @@ -6,7 +6,7 @@ import { AuthenticationForm } from './AuthenticationForm';
-

+

Login or Signup

diff --git a/src/components/RoadmapAIChat/RoadmapAIChat.tsx b/src/components/RoadmapAIChat/RoadmapAIChat.tsx index 3957f6f8b..35b6f5603 100644 --- a/src/components/RoadmapAIChat/RoadmapAIChat.tsx +++ b/src/components/RoadmapAIChat/RoadmapAIChat.tsx @@ -1,9 +1,7 @@ import './RoadmapAIChat.css'; import { useQuery } from '@tanstack/react-query'; -import { - roadmapJSONOptions -} from '../../queries/roadmap'; +import { roadmapJSONOptions } from '../../queries/roadmap'; import { queryClient } from '../../stores/query-client'; import { Fragment, @@ -13,7 +11,13 @@ import { useRef, useState, } from 'react'; -import { BotIcon, Frown, Loader2Icon, PauseCircleIcon, SendIcon } from 'lucide-react'; +import { + BotIcon, + Frown, + Loader2Icon, + PauseCircleIcon, + SendIcon, +} from 'lucide-react'; import { ChatEditor } from '../ChatEditor/ChatEditor'; import { roadmapTreeMappingOptions } from '../../queries/roadmap-tree'; import { type AllowedAIChatRole } from '../GenerateCourse/AICourseLessonChat'; @@ -352,24 +356,17 @@ export function RoadmapAIChat(props: RoadmapAIChatProps) { )}

-
{ - e.preventDefault(); - if (isStreamingMessage && abortControllerRef.current) { - handleAbort(); - return; - } - - handleChatSubmit(editorRef.current?.getJSON() || {}); - }} - > +
{ - if (isStreamingMessage && abortControllerRef.current) { - handleAbort(); + if (isStreamingMessage || abortControllerRef.current) { + return; + } + + if (isEmptyContent(content)) { + toast.error('Please enter a message'); return; } @@ -378,8 +375,15 @@ export function RoadmapAIChat(props: RoadmapAIChatProps) { /> - +
); } +function isEmptyContent(content: JSONContent) { + if (!content) { + return true; + } + + // because they wrap the content in type doc + const firstContent = content.content?.[0]; + if (!firstContent) { + return true; + } + + return ( + firstContent.type === 'paragraph' && + (!firstContent?.content || firstContent?.content?.length === 0) + ); +} + export function htmlFromTiptapJSON(json: JSONContent) { const content = json.content; diff --git a/src/components/RoadmapAIChat/UserProgressActionList.tsx b/src/components/RoadmapAIChat/UserProgressActionList.tsx index d0ed21f42..cc84fe22a 100644 --- a/src/components/RoadmapAIChat/UserProgressActionList.tsx +++ b/src/components/RoadmapAIChat/UserProgressActionList.tsx @@ -136,6 +136,8 @@ export function UserProgressActionList(props: UserProgressActionListProps) { ? progressItemWithText : progressItemWithText.slice(0, itemCountToShow); + const hasMoreItemsToShow = progressItemWithText.length > itemCountToShow; + return (
@@ -151,7 +153,7 @@ export function UserProgressActionList(props: UserProgressActionListProps) { /> ))} - {progressItemWithText.length > itemCountToShow && ( + {hasMoreItemsToShow && (
-
+ bulkUpdateResourceProgress({ + done, + learning, + skipped, + pending, + }); + }} + > + {isBulkUpdating && ( + + )} + {!isBulkUpdating && } + Apply All + +
+ )}
); } diff --git a/src/pages/ai/chat/index.astro b/src/pages/ai/chat/index.astro new file mode 100644 index 000000000..e8db89b51 --- /dev/null +++ b/src/pages/ai/chat/index.astro @@ -0,0 +1,27 @@ +--- +import { CheckSubscriptionVerification } from '../../../components/Billing/CheckSubscriptionVerification'; +import { RoadmapAIChat } from '../../../components/RoadmapAIChat/RoadmapAIChat'; +import SkeletonLayout from '../../../layouts/SkeletonLayout.astro'; +import { AITutorLayout } from '../../../components/AITutor/AITutorLayout'; + +type Props = { + roadmapId: string; +}; + +const { roadmapId } = Astro.params as Props; +--- + + + +

Roadmap AI Chat

+ +
+