From fb6ce2810404493bb4a0a52267df963862a2ad0a Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Thu, 1 May 2025 22:29:36 +0100 Subject: [PATCH] Topic chat --- src/components/TopicDetail/TopicDetail.tsx | 65 +++++---- .../TopicDetail/TopicProgressButton.tsx | 125 +++++++++--------- ...the-internet-work@yCnn-NfSxIybUQ2iTuUGq.md | 2 +- 3 files changed, 99 insertions(+), 93 deletions(-) diff --git a/src/components/TopicDetail/TopicDetail.tsx b/src/components/TopicDetail/TopicDetail.tsx index 00d71807a..c524e6f1a 100644 --- a/src/components/TopicDetail/TopicDetail.tsx +++ b/src/components/TopicDetail/TopicDetail.tsx @@ -14,7 +14,6 @@ import { updateResourceProgress as updateResourceProgressApi, } from '../../lib/resource-progress'; import { pageProgressMessage } from '../../stores/page'; -import { TopicProgressButton } from './TopicProgressButton'; import { showLoginPopup } from '../../lib/popup'; import { useToast } from '../../hooks/use-toast'; import type { @@ -22,16 +21,7 @@ import type { RoadmapContentDocument, } from '../CustomRoadmap/CustomRoadmap'; import { markdownToHtml, sanitizeMarkdown } from '../../lib/markdown'; -import { - Ban, - BookIcon, - Coins, - FileText, - HeartHandshake, - SparklesIcon, - Star, - X, -} from 'lucide-react'; +import { Ban, Coins, FileText, HeartHandshake, Star, X } from 'lucide-react'; import { getUrlParams, parseUrl } from '../../lib/browser'; import { Spinner } from '../ReactIcons/Spinner'; import { GitHubIcon } from '../ReactIcons/GitHubIcon.tsx'; @@ -50,6 +40,7 @@ import { TopicDetailAI } from './TopicDetailAI.tsx'; import { cn } from '../../lib/classname.ts'; import type { AIChatHistoryType } from '../GenerateCourse/AICourseLessonChat.tsx'; import { UpgradeAccountModal } from '../Billing/UpgradeAccountModal.tsx'; +import { TopicProgressButton } from './TopicProgressButton.tsx'; type TopicDetailProps = { resourceId?: string; @@ -405,7 +396,41 @@ export function TopicDetail(props: TopicDetailProps) { 'flex flex-col': activeTab === 'ai', })} > -
+
+
+ {!isEmbed && ( + + )} +
+ +
+ +
+
+ {shouldShowAiTab && ( + + )} +
{!isEmbed && ( )} - -
- {shouldShowAiTab && ( - - )} - {activeTab === 'ai' && shouldShowAiTab && ( = { + done: 'bg-green-500', + learning: 'bg-yellow-500', + pending: 'bg-gray-300', + skipped: 'bg-black', + removed: '', +}; + type TopicProgressButtonProps = { topicId: string; resourceId: string; @@ -25,14 +33,32 @@ type TopicProgressButtonProps = { onClose: () => void; }; -const statusColors: Record = { - done: 'bg-green-500', - learning: 'bg-yellow-500', - pending: 'bg-gray-300', - skipped: 'bg-black', - removed: '', +type ProgressDropdownItemProps = { + status: ResourceProgressType; + shortcutKey: string; + label: string; + onClick: () => void; }; +function ProgressDropdownItem(props: ProgressDropdownItemProps) { + const { status, shortcutKey, label, onClick } = props; + + return ( + + ); +} + export function TopicProgressButton(props: TopicProgressButtonProps) { const { topicId, resourceId, resourceType, onClose } = props; @@ -197,95 +223,66 @@ export function TopicProgressButton(props: TopicProgressButtonProps) { if (isUpdatingProgress) { return ( - ); } return ( -
- +
+ {showChangeStatus && (
{allowMarkingDone && ( - + /> )} {allowMarkingLearning && ( - + /> )} {allowMarkingPending && ( - + /> )} {allowMarkingSkipped && ( - + /> )}
)} diff --git a/src/data/roadmaps/frontend/content/how-does-the-internet-work@yCnn-NfSxIybUQ2iTuUGq.md b/src/data/roadmaps/frontend/content/how-does-the-internet-work@yCnn-NfSxIybUQ2iTuUGq.md index 774d46faa..458665bb6 100644 --- a/src/data/roadmaps/frontend/content/how-does-the-internet-work@yCnn-NfSxIybUQ2iTuUGq.md +++ b/src/data/roadmaps/frontend/content/how-does-the-internet-work@yCnn-NfSxIybUQ2iTuUGq.md @@ -1,6 +1,6 @@ # How Does The Internet Work -The Internet works through a global network of interconnected computers and servers, communicating via standardized protocols. Data is broken into packets and routed through various network nodes using the Internet Protocol (IP). These packets travel across different physical infrastructures, including fiber optic cables, satellites, and wireless networks. The Transmission Control Protocol (TCP) ensures reliable delivery and reassembly of packets at their destination. Domain Name System (DNS) servers translate human-readable website names into IP addresses. When you access a website, your device sends a request to the appropriate server, which responds with the requested data. This process, facilitated by routers, switches, and other networking equipment, enables the seamless exchange of information across vast distances, forming the backbone of our digital communications. +The internet is a global network that connects computers and devices so they can share information with each other. It’s how you browse websites, send emails, watch videos, and use apps. Think of it like a giant web that links everything together. Visit the following resources to learn more: