mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-31 04:59:50 +02:00
Improve AI tutor subject titles
This commit is contained in:
@@ -1,35 +1,37 @@
|
|||||||
import '../GenerateCourse/AICourseLessonChat.css';
|
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useState, useRef, Fragment, useCallback, useEffect } from 'react';
|
|
||||||
import { billingDetailsOptions } from '../../queries/billing';
|
|
||||||
import { getAiCourseLimitOptions } from '../../queries/ai-course';
|
|
||||||
import { queryClient } from '../../stores/query-client';
|
|
||||||
import { isLoggedIn, removeAuthToken } from '../../lib/jwt';
|
|
||||||
import {
|
import {
|
||||||
BotIcon,
|
BotIcon,
|
||||||
ChevronRightIcon,
|
ChevronRightIcon,
|
||||||
Gift,
|
Gift,
|
||||||
Loader2Icon,
|
Loader2Icon,
|
||||||
LockIcon, SendIcon, Trash2,
|
LockIcon,
|
||||||
WandSparkles
|
SendIcon,
|
||||||
|
Trash2,
|
||||||
|
WandSparkles,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { showLoginPopup } from '../../lib/popup';
|
import { Fragment, useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { cn } from '../../lib/classname';
|
|
||||||
import TextareaAutosize from 'react-textarea-autosize';
|
|
||||||
import { flushSync } from 'react-dom';
|
import { flushSync } from 'react-dom';
|
||||||
|
import TextareaAutosize from 'react-textarea-autosize';
|
||||||
|
import { useToast } from '../../hooks/use-toast';
|
||||||
|
import { readStream } from '../../lib/ai';
|
||||||
|
import { cn } from '../../lib/classname';
|
||||||
|
import { isLoggedIn, removeAuthToken } from '../../lib/jwt';
|
||||||
|
import { markdownToHtmlWithHighlighting } from '../../lib/markdown';
|
||||||
|
import { getPercentage } from '../../lib/number';
|
||||||
|
import { showLoginPopup } from '../../lib/popup';
|
||||||
|
import type { ResourceType } from '../../lib/resource-progress';
|
||||||
|
import { getAiCourseLimitOptions } from '../../queries/ai-course';
|
||||||
|
import { billingDetailsOptions } from '../../queries/billing';
|
||||||
|
import { roadmapTreeMappingOptions } from '../../queries/roadmap-tree';
|
||||||
|
import { queryClient } from '../../stores/query-client';
|
||||||
import {
|
import {
|
||||||
AIChatCard,
|
AIChatCard,
|
||||||
type AIChatHistoryType,
|
type AIChatHistoryType,
|
||||||
} from '../GenerateCourse/AICourseLessonChat';
|
} from '../GenerateCourse/AICourseLessonChat';
|
||||||
import { useToast } from '../../hooks/use-toast';
|
import '../GenerateCourse/AICourseLessonChat.css';
|
||||||
import { readStream } from '../../lib/ai';
|
|
||||||
import { markdownToHtmlWithHighlighting } from '../../lib/markdown';
|
|
||||||
import type { ResourceType } from '../../lib/resource-progress';
|
|
||||||
import { getPercentage } from '../../lib/number';
|
|
||||||
import { roadmapTreeMappingOptions } from '../../queries/roadmap-tree';
|
|
||||||
import { defaultChatHistory } from './TopicDetail';
|
|
||||||
import { AILimitsPopup } from '../GenerateCourse/AILimitsPopup';
|
import { AILimitsPopup } from '../GenerateCourse/AILimitsPopup';
|
||||||
import { PredefinedActions, promptLabelMapping } from './PredefinedActions';
|
import { PredefinedActions, promptLabelMapping } from './PredefinedActions';
|
||||||
|
import { defaultChatHistory } from './TopicDetail';
|
||||||
|
|
||||||
type TopicDetailAIProps = {
|
type TopicDetailAIProps = {
|
||||||
resourceId: string;
|
resourceId: string;
|
||||||
@@ -290,17 +292,22 @@ export function TopicDetailAI(props: TopicDetailAIProps) {
|
|||||||
href={`/ai/search?term=${roadmapTreeMapping?.text}&difficulty=beginner&src=topic`}
|
href={`/ai/search?term=${roadmapTreeMapping?.text}&difficulty=beginner&src=topic`}
|
||||||
className="flex items-center gap-1 rounded-md border border-gray-300 bg-gray-100 px-2 py-1 hover:bg-gray-200 hover:text-black"
|
className="flex items-center gap-1 rounded-md border border-gray-300 bg-gray-100 px-2 py-1 hover:bg-gray-200 hover:text-black"
|
||||||
>
|
>
|
||||||
{nodeTextParts.map((text, index) => (
|
{nodeTextParts.slice(1).map((text, index) => {
|
||||||
<>
|
// -2 because we are removing roadmap title from the list
|
||||||
<span key={text} className="flex items-center">
|
const isLast = index === nodeTextParts.length - 2;
|
||||||
{text}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{index !== nodeTextParts.length - 1 && (
|
return (
|
||||||
<ChevronRightIcon className="h-3 w-3 text-gray-400" />
|
<>
|
||||||
)}
|
<span key={text} className="flex items-center">
|
||||||
</>
|
{text}
|
||||||
))}
|
</span>
|
||||||
|
|
||||||
|
{!isLast && (
|
||||||
|
<ChevronRightIcon className="h-3 w-3 text-gray-400" />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user