mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-07 02:48:05 +08:00
Remove course pages, APIs and the course_study capability. Add anchored note threads and reviewed learning-block generation, queued and withdrawable chat messages, quote attachments, side chats, and the calendar/favorites/navigation updates. Keep preview's existing backend architecture. Wire the new features through its Python application and existing chat engine, retain legacy selected-text requests, persist mid-turn messages in replay, and restore note context when regenerating. Leave stored user data intact. Validate frontend contracts, dependency boundaries, types, 1290 node tests, 840 rendered tests, lint, localization and the production build. Exercise session/notes/API regressions, 53 chat-engine tests and 20 Python/native integration tests with isolated runtime data.
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { createElement } from 'react'
|
|
import {
|
|
Bookmark,
|
|
BookOpen,
|
|
Bot,
|
|
Calculator,
|
|
FileQuestion,
|
|
FileText,
|
|
GraduationCap,
|
|
MessageSquare,
|
|
Search,
|
|
Video,
|
|
type LucideIcon,
|
|
} from 'lucide-react'
|
|
import { FAVORITE_LABELS } from '@/lib/favorite-content'
|
|
|
|
/** One icon and label per kind of favorite, shared by every surface that
|
|
* shows one: the collection page, the note picker and the card on a page.
|
|
* The tint lives in favorites.css under `[data-kind]`. */
|
|
const ICONS: Record<string, LucideIcon> = {
|
|
chat: MessageSquare,
|
|
tutorbot: Bot,
|
|
research: Search,
|
|
reading: BookOpen,
|
|
video_learning: Video,
|
|
question: FileQuestion,
|
|
solve: Calculator,
|
|
co_writer: FileText,
|
|
guided_learning: GraduationCap,
|
|
}
|
|
|
|
export function favoriteIcon(kind: string): LucideIcon {
|
|
return ICONS[kind] || Bookmark
|
|
}
|
|
|
|
export function favoriteLabel(kind: string): string {
|
|
return FAVORITE_LABELS[kind] || 'Favorite content'
|
|
}
|
|
|
|
/** The kind's icon on its tinted tile. */
|
|
export function FavoriteKindIcon({ kind, size = 16 }: { kind: string; size?: number }) {
|
|
return (
|
|
<span className="dt-fav-kind" data-kind={kind} aria-hidden>
|
|
{createElement(favoriteIcon(kind), { size, strokeWidth: 1.7 })}
|
|
</span>
|
|
)
|
|
}
|