1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-09-26 08:59:01 +02:00

Update chat

This commit is contained in:
Kamran Ahmed
2025-05-22 12:36:54 +01:00
parent eef9c78720
commit 041f090a47

View File

@@ -17,9 +17,7 @@ import {
import { BotIcon, Loader2Icon, PauseCircleIcon, SendIcon } from 'lucide-react'; import { BotIcon, Loader2Icon, PauseCircleIcon, SendIcon } from 'lucide-react';
import { ChatEditor } from '../ChatEditor/ChatEditor'; import { ChatEditor } from '../ChatEditor/ChatEditor';
import { roadmapTreeMappingOptions } from '../../queries/roadmap-tree'; import { roadmapTreeMappingOptions } from '../../queries/roadmap-tree';
import { import { type AllowedAIChatRole } from '../GenerateCourse/AICourseLessonChat';
type AllowedAIChatRole
} from '../GenerateCourse/AICourseLessonChat';
import { isLoggedIn, removeAuthToken } from '../../lib/jwt'; import { isLoggedIn, removeAuthToken } from '../../lib/jwt';
import type { JSONContent, Editor } from '@tiptap/core'; import type { JSONContent, Editor } from '@tiptap/core';
import { flushSync } from 'react-dom'; import { flushSync } from 'react-dom';
@@ -285,23 +283,25 @@ export function RoadmapAIChat(props: RoadmapAIChatProps) {
}, []); }, []);
return ( return (
<div className="flex flex-row flex-grow"> <div className="flex flex-grow flex-row">
<div className="relative flex-grow h-full overflow-y-scroll"> <div className="relative h-full flex-grow overflow-y-scroll">
{isLoading && ( {isLoading && (
<div className="absolute inset-0 flex h-full w-full items-center justify-center"> <div className="absolute inset-0 flex h-full w-full items-center justify-center">
<Loader2Icon className="size-6 animate-spin stroke-[2.5]" /> <Loader2Icon className="size-6 animate-spin stroke-[2.5]" />
</div> </div>
)} )}
{roadmapJSONData?.json && !isLoading && ( {roadmapJSONData?.json && !isLoading && (
<div className="mx-auto max-w-[968px] px-4">
<ChatRoadmapRenderer <ChatRoadmapRenderer
roadmapId={roadmapId} roadmapId={roadmapId}
nodes={roadmapJSONData?.json.nodes} nodes={roadmapJSONData?.json.nodes}
edges={roadmapJSONData?.json.edges} edges={roadmapJSONData?.json.edges}
/> />
</div>
)} )}
</div> </div>
<div className="flex-grow max-w-[40%] flex h-full flex-col border-l border-gray-200 bg-white"> <div className="flex h-full max-w-[40%] flex-grow flex-col border-l border-gray-200 bg-white">
<div className="flex min-h-[46px] items-center justify-between gap-2 border-b border-gray-200 px-3 py-2 text-sm"> <div className="flex min-h-[46px] items-center justify-between gap-2 border-b border-gray-200 px-3 py-2 text-sm">
<span className="flex items-center gap-2 text-sm"> <span className="flex items-center gap-2 text-sm">
<BotIcon className="size-4 shrink-0 text-black" /> <BotIcon className="size-4 shrink-0 text-black" />