style: 统一为 d-sre-agent 的配色与界面风格 #1
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
357
app/courses/page.tsx
Normal file
357
app/courses/page.tsx
Normal file
@ -0,0 +1,357 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
import { useRef, useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowRight,
|
||||
BookOpen,
|
||||
Check,
|
||||
Clock,
|
||||
FileText,
|
||||
Loader2,
|
||||
Search,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { BrandLogo } from '@/components/brand-logo';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { chapters, courses, searchChapters, type MarketCourse } from '@/lib/course-market/catalog';
|
||||
import { useImportClassroom } from '@/lib/import/use-import-classroom';
|
||||
import { loadStageData } from '@/lib/utils/stage-storage';
|
||||
|
||||
const domains = [...new Set(chapters.map((chapter) => chapter.domain))];
|
||||
const courseKey = (course: MarketCourse) => `course-market:${course.id}:v${course.version}`;
|
||||
|
||||
export default function CourseMarketPage() {
|
||||
const router = useRouter();
|
||||
const [query, setQuery] = useState('');
|
||||
const [domain, setDomain] = useState('');
|
||||
const [publishedOnly, setPublishedOnly] = useState(false);
|
||||
const [chapterId, setChapterId] = useState('');
|
||||
const [opening, setOpening] = useState<string | null>(null);
|
||||
const pendingCourse = useRef<MarketCourse | null>(null);
|
||||
const busy = useRef(false);
|
||||
const { importFile } = useImportClassroom((stageId) => {
|
||||
if (pendingCourse.current) {
|
||||
try {
|
||||
localStorage.setItem(courseKey(pendingCourse.current), stageId);
|
||||
} catch {
|
||||
/* Course is already saved. */
|
||||
}
|
||||
}
|
||||
router.push(`/classroom/${stageId}`);
|
||||
});
|
||||
|
||||
const filtered = searchChapters(query, domain, publishedOnly);
|
||||
const visible = chapterId ? filtered.filter((chapter) => chapter.id === chapterId) : filtered;
|
||||
const reset = () => {
|
||||
setQuery('');
|
||||
setDomain('');
|
||||
setPublishedOnly(false);
|
||||
setChapterId('');
|
||||
};
|
||||
|
||||
async function openCourse(course: MarketCourse) {
|
||||
if (busy.current) return;
|
||||
busy.current = true;
|
||||
setOpening(course.id);
|
||||
pendingCourse.current = course;
|
||||
try {
|
||||
let savedId: string | null = null;
|
||||
try {
|
||||
savedId = localStorage.getItem(courseKey(course));
|
||||
} catch {
|
||||
/* Continue with import. */
|
||||
}
|
||||
if (savedId && (await loadStageData(savedId))) {
|
||||
router.push(`/classroom/${savedId}`);
|
||||
return;
|
||||
}
|
||||
const response = await fetch(course.packageUrl);
|
||||
if (!response.ok) throw new Error('课程包暂时无法下载,请稍后重试。');
|
||||
await importFile(
|
||||
new File([await response.blob()], `${course.id}.maic.zip`, { type: 'application/zip' }),
|
||||
);
|
||||
} catch (error) {
|
||||
toast.error(error instanceof Error ? error.message : '打开课程失败,请重试。');
|
||||
} finally {
|
||||
busy.current = false;
|
||||
pendingCourse.current = null;
|
||||
setOpening(null);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background text-foreground">
|
||||
<header className="border-b border-border bg-background">
|
||||
<div className="mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-3 px-5 py-4 sm:px-8">
|
||||
<Link href="/" aria-label="地瓜学习平台首页">
|
||||
<BrandLogo className="text-base font-semibold" />
|
||||
</Link>
|
||||
<Link
|
||||
href="/"
|
||||
className="flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<ArrowLeft className="size-4" />
|
||||
返回首页
|
||||
</Link>
|
||||
</div>
|
||||
</header>
|
||||
<main className="mx-auto max-w-7xl px-5 py-8 sm:px-8 sm:py-12">
|
||||
<section className="mb-8 flex flex-col justify-between gap-6 sm:flex-row sm:items-end">
|
||||
<div>
|
||||
<p className="mb-3 text-xs font-semibold tracking-widest text-orange-600 dark:text-orange-400">
|
||||
RDK LEARNING
|
||||
</p>
|
||||
<h1 className="text-3xl font-semibold tracking-tight sm:text-4xl">课程市场</h1>
|
||||
<p className="mt-3 max-w-xl text-sm leading-7 text-muted-foreground">
|
||||
从第一块开发板开始,逐章建立你的工程知识。选择章节,查看知识点,进入课程学习。
|
||||
</p>
|
||||
<button
|
||||
onClick={() => {
|
||||
reset();
|
||||
setPublishedOnly(true);
|
||||
}}
|
||||
className="mt-3 inline-flex items-center gap-1.5 text-sm font-medium text-orange-600 hover:underline dark:text-orange-400"
|
||||
>
|
||||
查看可学课程
|
||||
<ArrowRight className="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex gap-8 text-sm">
|
||||
<div>
|
||||
<strong className="block text-2xl font-semibold">{chapters.length}</strong>
|
||||
<span className="text-muted-foreground">学习章节</span>
|
||||
</div>
|
||||
<div>
|
||||
<strong className="block text-2xl font-semibold">{courses.length}</strong>
|
||||
<span className="text-muted-foreground">已上线课程</span>
|
||||
</div>
|
||||
<div>
|
||||
<strong className="block text-2xl font-semibold">260</strong>
|
||||
<span className="text-muted-foreground">细分小节</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section
|
||||
aria-label="筛选课程"
|
||||
className="mb-8 flex flex-col gap-3 rounded-xl border border-border bg-card p-4 sm:flex-row sm:items-center"
|
||||
>
|
||||
<div className="relative flex-1">
|
||||
<Search className="absolute top-3 left-3 size-4 text-muted-foreground" />
|
||||
<input
|
||||
aria-label="搜索章节、课程或知识点"
|
||||
value={query}
|
||||
onChange={(event) => {
|
||||
setQuery(event.target.value);
|
||||
setChapterId('');
|
||||
}}
|
||||
placeholder="搜索章节、课程或知识点,如 RDK、Python、串口"
|
||||
className="h-10 w-full rounded-md border border-input bg-background pr-3 pl-9 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
/>
|
||||
</div>
|
||||
<select
|
||||
aria-label="知识领域"
|
||||
value={domain}
|
||||
onChange={(event) => {
|
||||
setDomain(event.target.value);
|
||||
setChapterId('');
|
||||
}}
|
||||
className="h-10 rounded-md border border-input bg-background px-3 text-sm"
|
||||
>
|
||||
<option value="">全部领域</option>
|
||||
{domains.map((item) => (
|
||||
<option key={item}>{item}</option>
|
||||
))}
|
||||
</select>
|
||||
<label className="flex min-h-10 cursor-pointer items-center gap-2 whitespace-nowrap text-sm">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={publishedOnly}
|
||||
onChange={(event) => {
|
||||
setPublishedOnly(event.target.checked);
|
||||
setChapterId('');
|
||||
}}
|
||||
className="accent-orange-600"
|
||||
/>
|
||||
仅看已上线
|
||||
</label>
|
||||
</section>
|
||||
<div className="grid items-start gap-8 lg:grid-cols-[240px_minmax(0,1fr)]">
|
||||
<aside className="lg:sticky lg:top-5">
|
||||
<h2 className="mb-3 flex items-center gap-2 text-sm font-semibold">
|
||||
<BookOpen className="size-4" />
|
||||
章节目录
|
||||
</h2>
|
||||
<nav
|
||||
aria-label="章节目录"
|
||||
className="max-h-60 overflow-y-auto rounded-lg border border-border p-2 lg:max-h-[70vh]"
|
||||
>
|
||||
<button
|
||||
onClick={() => setChapterId('')}
|
||||
aria-current={!chapterId ? 'true' : undefined}
|
||||
className={`mb-1 w-full rounded-md px-3 py-2 text-left text-sm ${!chapterId ? 'bg-muted font-semibold' : 'hover:bg-muted'}`}
|
||||
>
|
||||
全部章节 <span className="text-muted-foreground">{filtered.length}</span>
|
||||
</button>
|
||||
{filtered.map((chapter) => (
|
||||
<button
|
||||
key={chapter.id}
|
||||
onClick={() => setChapterId(chapter.id)}
|
||||
aria-current={chapterId === chapter.id ? 'true' : undefined}
|
||||
className={`flex w-full items-start gap-2 rounded-md px-3 py-2.5 text-left text-xs leading-5 ${chapterId === chapter.id ? 'bg-orange-50 text-orange-700 dark:bg-orange-950/40 dark:text-orange-300' : 'text-muted-foreground hover:bg-muted hover:text-foreground'}`}
|
||||
>
|
||||
<span className="font-mono">{chapter.id}</span>
|
||||
<span>{chapter.title}</span>
|
||||
{courses.some((course) => course.chapterId === chapter.id) && (
|
||||
<Check className="mt-1 ml-auto size-3 shrink-0 text-orange-600" />
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
</aside>
|
||||
<div className="min-w-0">
|
||||
<div className="mb-4 flex items-center justify-between text-sm">
|
||||
<p className="text-muted-foreground">
|
||||
{visible.length} 个章节 ·{' '}
|
||||
{
|
||||
courses.filter((course) =>
|
||||
visible.some((chapter) => chapter.id === course.chapterId),
|
||||
).length
|
||||
}{' '}
|
||||
门可学课程
|
||||
</p>
|
||||
<button
|
||||
onClick={reset}
|
||||
className="underline underline-offset-4 hover:text-orange-600"
|
||||
>
|
||||
重置筛选
|
||||
</button>
|
||||
</div>
|
||||
{visible.length === 0 && (
|
||||
<div className="rounded-xl border border-dashed border-border px-5 py-16 text-center">
|
||||
<Search className="mx-auto mb-4 size-7 text-muted-foreground" />
|
||||
<h2 className="font-semibold">没有找到匹配的章节</h2>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
试试更短的关键词,或清除筛选条件。
|
||||
</p>
|
||||
<Button variant="outline" onClick={reset} className="mt-5">
|
||||
查看全部章节
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-5">
|
||||
{visible.map((chapter) => {
|
||||
const chapterCourses = courses.filter((course) => course.chapterId === chapter.id);
|
||||
return (
|
||||
<section
|
||||
key={chapter.id}
|
||||
aria-label={`第 ${chapter.id} 章 ${chapter.title}`}
|
||||
className="overflow-hidden rounded-xl border border-border bg-card"
|
||||
>
|
||||
<div className="p-5 sm:p-6">
|
||||
<div className="mb-3 flex flex-wrap items-center gap-2 text-xs">
|
||||
<span className="font-mono text-orange-600 dark:text-orange-400">
|
||||
CHAPTER {chapter.id}
|
||||
</span>
|
||||
<span className="rounded bg-muted px-2 py-1 text-muted-foreground">
|
||||
{chapter.domain}
|
||||
</span>
|
||||
<span className="text-muted-foreground">{chapter.level}</span>
|
||||
</div>
|
||||
<h2 className="text-lg font-semibold">{chapter.title}</h2>
|
||||
<p className="mt-2 text-xs leading-6 text-muted-foreground">
|
||||
{chapter.sections.length} 小节 ·{' '}
|
||||
{chapter.sections.reduce((sum, section) => sum + section.points.length, 0)}{' '}
|
||||
个知识点 · 建议先修:
|
||||
{chapter.prerequisites.length
|
||||
? chapter.prerequisites.map((id) => `第 ${id} 章`).join('、')
|
||||
: '无需先修'}
|
||||
</p>
|
||||
<details className="mt-4">
|
||||
<summary className="cursor-pointer text-sm font-medium hover:text-orange-600">
|
||||
查看小节与知识点
|
||||
</summary>
|
||||
<div className="mt-4 space-y-4 border-l-2 border-orange-500/30 pl-4">
|
||||
{chapter.sections.map((section) => (
|
||||
<div key={section.id}>
|
||||
<h3 className="text-sm font-medium">
|
||||
{section.id} {section.title}
|
||||
</h3>
|
||||
<ul className="mt-2 grid gap-x-5 gap-y-1 text-xs leading-6 text-muted-foreground sm:grid-cols-2">
|
||||
{section.points.map((point) => (
|
||||
<li key={point.id}>{point.title}</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<div className="border-t border-border bg-muted/30 p-5 sm:p-6">
|
||||
{chapterCourses.length ? (
|
||||
chapterCourses.map((course) => (
|
||||
<article
|
||||
key={course.id}
|
||||
className="flex flex-col justify-between gap-5 sm:flex-row sm:items-center"
|
||||
>
|
||||
<div className="min-w-0">
|
||||
<p className="mb-2 text-xs font-medium text-orange-600 dark:text-orange-400">
|
||||
平台精选 · 已上线
|
||||
</p>
|
||||
<h3 className="font-semibold">{course.title}</h3>
|
||||
<p className="mt-2 max-w-xl text-sm leading-6 text-muted-foreground">
|
||||
{course.description}
|
||||
</p>
|
||||
<div className="mt-3 flex flex-wrap gap-4 text-xs text-muted-foreground">
|
||||
<span className="flex items-center gap-1">
|
||||
<Clock className="size-3.5" />
|
||||
{course.duration}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<FileText className="size-3.5" />
|
||||
{course.pages} 页 · 含测验
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
disabled={opening !== null}
|
||||
onClick={() => void openCourse(course)}
|
||||
className="shrink-0 gap-2"
|
||||
>
|
||||
{opening === course.id ? (
|
||||
<>
|
||||
<Loader2 className="size-4 animate-spin" />
|
||||
准备课程…
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
进入学习
|
||||
<ArrowRight className="size-4" />
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</article>
|
||||
))
|
||||
) : (
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 text-sm">
|
||||
<span className="text-muted-foreground">
|
||||
本章课程正在规划,知识大纲可先行查看。
|
||||
</span>
|
||||
<span className="rounded-full border border-border px-3 py-1 text-xs text-muted-foreground">
|
||||
待上线
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
BIN
app/favicon.ico
BIN
app/favicon.ico
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB |
@ -1191,7 +1191,7 @@ function GenerationPreviewContent() {
|
||||
// Still loading session from sessionStorage
|
||||
if (!sessionLoaded) {
|
||||
return (
|
||||
<div className="min-h-[100dvh] w-full bg-gradient-to-b from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900 flex items-center justify-center p-4">
|
||||
<div className="min-h-[100dvh] w-full bg-canvas flex items-center justify-center p-4">
|
||||
<div className="text-center text-muted-foreground">
|
||||
<div className="size-8 border-2 border-current border-t-transparent rounded-full animate-spin mx-auto" />
|
||||
</div>
|
||||
@ -1202,7 +1202,7 @@ function GenerationPreviewContent() {
|
||||
// No session found
|
||||
if (!session) {
|
||||
return (
|
||||
<div className="min-h-[100dvh] w-full bg-gradient-to-b from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900 flex items-center justify-center p-4">
|
||||
<div className="min-h-[100dvh] w-full bg-canvas flex items-center justify-center p-4">
|
||||
<Card className="p-8 max-w-md w-full">
|
||||
<div className="text-center space-y-4">
|
||||
<AlertCircle className="size-12 text-muted-foreground mx-auto" />
|
||||
@ -1234,7 +1234,7 @@ function GenerationPreviewContent() {
|
||||
const editorOutlines = session.sceneOutlines ?? streamingOutlines ?? [];
|
||||
|
||||
return (
|
||||
<div className="min-h-[100dvh] w-full bg-gradient-to-b from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900 flex flex-col items-center p-4 relative overflow-hidden">
|
||||
<div className="min-h-[100dvh] w-full bg-canvas flex flex-col items-center p-4 relative overflow-hidden">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: -20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
@ -1303,7 +1303,7 @@ function GenerationPreviewContent() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-[100dvh] w-full bg-gradient-to-b from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900 flex flex-col items-center justify-center p-4 relative overflow-hidden text-center">
|
||||
<div className="min-h-[100dvh] w-full bg-canvas flex flex-col items-center justify-center p-4 relative overflow-hidden text-center">
|
||||
{/* Background Decor */}
|
||||
<div className="fixed inset-0 overflow-hidden pointer-events-none z-0">
|
||||
<div
|
||||
@ -1311,7 +1311,7 @@ function GenerationPreviewContent() {
|
||||
style={{ animationDuration: '4s' }}
|
||||
/>
|
||||
<div
|
||||
className="absolute bottom-0 right-1/4 w-96 h-96 bg-purple-500/10 rounded-full blur-3xl animate-pulse"
|
||||
className="absolute bottom-0 right-1/4 w-96 h-96 bg-neutral-500/10 rounded-full blur-3xl animate-pulse"
|
||||
style={{ animationDuration: '6s' }}
|
||||
/>
|
||||
</div>
|
||||
@ -1335,7 +1335,7 @@ function GenerationPreviewContent() {
|
||||
transition={{ duration: 0.5 }}
|
||||
className="w-full"
|
||||
>
|
||||
<Card className="relative overflow-hidden border-muted/40 shadow-2xl bg-white/80 dark:bg-slate-900/80 backdrop-blur-xl min-h-[400px] flex flex-col items-center justify-center p-8 md:p-12">
|
||||
<Card className="relative overflow-hidden border-muted/40 shadow-2xl bg-white/80 dark:bg-neutral-900/80 backdrop-blur-xl min-h-[400px] flex flex-col items-center justify-center p-8 md:p-12">
|
||||
{/* Progress Dots */}
|
||||
<div className="absolute top-6 left-0 right-0 flex justify-center gap-2">
|
||||
{activeSteps.map((step, idx) => (
|
||||
@ -1510,7 +1510,7 @@ function GenerationPreviewContent() {
|
||||
{generatedAgents.length > 0 && !showAgentReveal && (
|
||||
<button
|
||||
onClick={() => setShowAgentReveal(true)}
|
||||
className="ml-2 flex items-center gap-1.5 rounded-full border border-purple-300/30 bg-purple-500/10 px-3 py-1 text-xs font-medium normal-case tracking-normal text-purple-400 transition-colors hover:bg-purple-500/20 hover:text-purple-300"
|
||||
className="ml-2 flex items-center gap-1.5 rounded-full border border-neutral-300/30 bg-neutral-500/10 px-3 py-1 text-xs font-medium normal-case tracking-normal text-neutral-400 transition-colors hover:bg-neutral-500/20 hover:text-neutral-300"
|
||||
>
|
||||
<Bot className="size-3" />
|
||||
{t('generation.viewAgents')}
|
||||
@ -1540,7 +1540,7 @@ export default function GenerationPreviewPage() {
|
||||
return (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="min-h-[100dvh] w-full bg-gradient-to-b from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900 flex items-center justify-center">
|
||||
<div className="min-h-[100dvh] w-full bg-canvas flex items-center justify-center">
|
||||
<div className="animate-pulse space-y-4 text-center">
|
||||
<div className="h-8 w-48 bg-muted rounded mx-auto" />
|
||||
<div className="h-4 w-64 bg-muted rounded mx-auto" />
|
||||
|
||||
180
app/globals.css
180
app/globals.css
@ -18,6 +18,10 @@
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-canvas: var(--canvas);
|
||||
--color-brand: var(--brand);
|
||||
--color-brand-muted: var(--brand-muted);
|
||||
--color-field: var(--field);
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-sans);
|
||||
@ -54,84 +58,87 @@
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--radius-2xl: calc(var(--radius) + 8px);
|
||||
--radius-xl: calc(var(--radius) + 2px);
|
||||
--radius-2xl: calc(var(--radius) + 4px);
|
||||
--radius-3xl: calc(var(--radius) + 12px);
|
||||
--radius-4xl: calc(var(--radius) + 16px);
|
||||
}
|
||||
|
||||
:root {
|
||||
/* Inter is loaded from @fontsource in app/layout.tsx, which declares one
|
||||
@font-face per unicode subset. Previously this came from next/font wrapping
|
||||
a single latin-only file, which left Cyrillic and Vietnamese text to OS
|
||||
fallback fonts. */
|
||||
--font-sans: 'Inter Variable', ui-sans-serif, system-ui, sans-serif;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: #722ed1;
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.58 0.22 27);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.809 0.105 251.813);
|
||||
--chart-2: oklch(0.623 0.214 259.815);
|
||||
--chart-3: oklch(0.546 0.245 262.881);
|
||||
--chart-4: oklch(0.488 0.243 264.376);
|
||||
--chart-5: oklch(0.424 0.199 265.638);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
color-scheme: light;
|
||||
/* d-sre-agent default appearance. Keep action and brand colors separate. */
|
||||
--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
--canvas: #f5f5f5;
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
--card: #ffffff;
|
||||
--card-foreground: var(--foreground);
|
||||
--popover: #ffffff;
|
||||
--popover-foreground: var(--foreground);
|
||||
--primary: #171717;
|
||||
--primary-foreground: #ffffff;
|
||||
--secondary: #f5f5f5;
|
||||
--secondary-foreground: #262626;
|
||||
--muted: #f5f5f5;
|
||||
--muted-foreground: #525252;
|
||||
--accent: #e5e5e5;
|
||||
--accent-foreground: var(--foreground);
|
||||
--brand: #ea580c;
|
||||
--brand-muted: #fff7ed;
|
||||
--field: #fafafa;
|
||||
--destructive: #b91c1c;
|
||||
--border: #e5e5e5;
|
||||
--input: #d4d4d4;
|
||||
--ring: #525252;
|
||||
--chart-1: #ea580c;
|
||||
--chart-2: #2563eb;
|
||||
--chart-3: #15803d;
|
||||
--chart-4: #a16207;
|
||||
--chart-5: #737373;
|
||||
--radius: 0.5rem;
|
||||
--sidebar: #fafafa;
|
||||
--sidebar-foreground: var(--foreground);
|
||||
--sidebar-primary: var(--primary);
|
||||
--sidebar-primary-foreground: var(--primary-foreground);
|
||||
--sidebar-accent: var(--accent);
|
||||
--sidebar-accent-foreground: var(--foreground);
|
||||
--sidebar-border: var(--border);
|
||||
--sidebar-ring: var(--ring);
|
||||
--shadow-floating: 0 8px 28px #0000001a, 0 1px 3px #0000000d;
|
||||
--shadow-menu: 0 6px 20px #00000014;
|
||||
--shadow-prompt: 0 2px 8px #00000014;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: #8b47ea;
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.371 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.809 0.105 251.813);
|
||||
--chart-2: oklch(0.623 0.214 259.815);
|
||||
--chart-3: oklch(0.546 0.245 262.881);
|
||||
--chart-4: oklch(0.488 0.243 264.376);
|
||||
--chart-5: oklch(0.424 0.199 265.638);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
color-scheme: dark;
|
||||
--canvas: #0a0a0a;
|
||||
--background: #0a0a0a;
|
||||
--foreground: #f5f5f5;
|
||||
--card: #171717;
|
||||
--popover: #171717;
|
||||
--primary: #f5f5f5;
|
||||
--primary-foreground: #0a0a0a;
|
||||
--secondary: #262626;
|
||||
--secondary-foreground: #f5f5f5;
|
||||
--muted: #262626;
|
||||
--muted-foreground: #a3a3a3;
|
||||
--accent: #404040;
|
||||
--brand: #fb923c;
|
||||
--brand-muted: #431407;
|
||||
--field: #171717;
|
||||
--destructive: #f87171;
|
||||
--border: #262626;
|
||||
--input: #525252;
|
||||
--ring: #a3a3a3;
|
||||
--chart-1: #fb923c;
|
||||
--chart-2: #60a5fa;
|
||||
--chart-3: #4ade80;
|
||||
--chart-4: #fbbf24;
|
||||
--chart-5: #a3a3a3;
|
||||
--sidebar: #171717;
|
||||
--shadow-floating: 0 8px 28px #00000052, 0 1px 3px #00000033;
|
||||
--shadow-menu: 0 6px 20px #00000052;
|
||||
--shadow-prompt: 0 2px 8px #00000033;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@ -149,6 +156,8 @@
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
font-family: var(--font-sans);
|
||||
font-weight: 450;
|
||||
}
|
||||
/* Radix modal overlays wrap with `react-remove-scroll`, which compensates
|
||||
for the removed page scrollbar by adding right-side body spacing. This
|
||||
@ -576,3 +585,34 @@ body[data-maic-editor='true'] .editable-element-text li,
|
||||
-webkit-text-fill-color: var(--muted-foreground);
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep the same settings controls reachable on narrow screens. */
|
||||
@media (max-width: 767px) {
|
||||
.settings-navigation {
|
||||
width: 100% !important;
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
overflow-x: auto;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.settings-navigation > button {
|
||||
width: auto;
|
||||
flex-shrink: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.settings-providers {
|
||||
width: 100% !important;
|
||||
max-height: 116px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.settings-providers > div:first-child {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.settings-providers > div:first-child > button {
|
||||
width: auto;
|
||||
flex-shrink: 0;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { DEFAULT_BRAND } from '@/lib/brand/brand-config';
|
||||
import type { Metadata } from 'next';
|
||||
import { GeistSans } from 'geist/font/sans';
|
||||
import { GeistMono } from 'geist/font/mono';
|
||||
@ -13,25 +14,10 @@ import { StorageHealthNotice } from '@/components/storage-health-notice';
|
||||
import { AccessCodeGuard } from '@/components/access-code-guard';
|
||||
import { ProSwapWatcher } from '@/components/workbench/ProSwapWatcher';
|
||||
|
||||
// The UI font is loaded from @fontsource's stylesheet rather than next/font,
|
||||
// because only the stylesheet carries the per-subset `unicode-range`
|
||||
// declarations. Pointing next/font at `inter-latin-wght-normal.woff2` loaded
|
||||
// exactly one subset, so every character outside Latin — Cyrillic for ru-RU,
|
||||
// tone-marked letters for vi-VN — fell back to an arbitrary OS font and
|
||||
// rendered in a different typeface mid-word.
|
||||
//
|
||||
// Declaring the other subset files as sibling faces of the same family does not
|
||||
// fix it either: faces with identical descriptors and no `unicode-range` do not
|
||||
// fall through per glyph, so the browser simply picks one.
|
||||
//
|
||||
// `--font-sans` moves to globals.css since the family no longer comes from
|
||||
// next/font's generated class.
|
||||
import '@fontsource-variable/inter';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'OpenMAIC',
|
||||
description:
|
||||
'The open-source AI interactive classroom. Upload a PDF to instantly generate an immersive, multi-agent learning experience.',
|
||||
icons: { icon: DEFAULT_BRAND.markSrc, apple: DEFAULT_BRAND.markSrc },
|
||||
title: DEFAULT_BRAND.productName,
|
||||
description: '地瓜学习平台,提供 RDK、机器人与嵌入式技术的 AI 互动课程。',
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
|
||||
136
app/page.tsx
136
app/page.tsx
@ -1,5 +1,9 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
import { BookOpen } from 'lucide-react';
|
||||
import { BrandLogo } from '@/components/brand-logo';
|
||||
import { DEFAULT_BRAND } from '@/lib/brand/brand-config';
|
||||
import { useState, useEffect, useMemo, useRef, useDeferredValue } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { motion, AnimatePresence } from 'motion/react';
|
||||
@ -703,7 +707,7 @@ function HomePage() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-[100dvh] w-full bg-gradient-to-b from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900 flex flex-col items-center p-4 pt-16 md:p-8 md:pt-16 overflow-x-hidden">
|
||||
<div className="min-h-[100dvh] w-full bg-canvas flex flex-col items-center p-4 pt-16 md:p-8 md:pt-16 overflow-x-hidden">
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
@ -723,12 +727,20 @@ function HomePage() {
|
||||
{/* ═══ Top-right pill (unchanged) ═══ */}
|
||||
<div
|
||||
ref={toolbarRef}
|
||||
className="fixed top-4 right-4 z-50 flex items-center gap-1 bg-white/60 dark:bg-gray-800/60 backdrop-blur-md px-2 py-1.5 rounded-full border border-gray-100/50 dark:border-gray-700/50 shadow-sm"
|
||||
className="fixed top-4 right-4 z-50 flex items-center gap-1 bg-background px-1.5 py-1 rounded-lg border border-border"
|
||||
>
|
||||
<Link
|
||||
href="/courses"
|
||||
className="flex items-center gap-1.5 rounded-md px-2 py-2 text-sm font-medium hover:bg-muted"
|
||||
>
|
||||
<BookOpen className="size-4" />
|
||||
课程市场
|
||||
</Link>
|
||||
<div className="h-4 w-px bg-border" />
|
||||
{/* Language Selector */}
|
||||
<LanguageSwitcher onOpen={() => setThemeOpen(false)} />
|
||||
|
||||
<div className="w-[1px] h-4 bg-gray-200 dark:bg-gray-700" />
|
||||
<div className="w-[1px] h-4 bg-neutral-200 dark:bg-neutral-700" />
|
||||
|
||||
{/* Theme Selector */}
|
||||
<div className="relative">
|
||||
@ -736,23 +748,24 @@ function HomePage() {
|
||||
onClick={() => {
|
||||
setThemeOpen(!themeOpen);
|
||||
}}
|
||||
className="p-2 rounded-full text-gray-400 dark:text-gray-500 hover:bg-white dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 hover:shadow-sm transition-all"
|
||||
aria-label={t('settings.theme')}
|
||||
className="p-2 rounded-full text-neutral-400 dark:text-neutral-500 hover:bg-white dark:hover:bg-neutral-700 hover:text-neutral-800 dark:hover:text-neutral-200 hover:shadow-sm transition-all"
|
||||
>
|
||||
{theme === 'light' && <Sun className="w-4 h-4" />}
|
||||
{theme === 'dark' && <Moon className="w-4 h-4" />}
|
||||
{theme === 'system' && <Monitor className="w-4 h-4" />}
|
||||
</button>
|
||||
{themeOpen && (
|
||||
<div className="absolute top-full mt-2 right-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden z-50 min-w-[140px]">
|
||||
<div className="absolute top-full mt-2 right-0 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg overflow-hidden z-50 min-w-[140px]">
|
||||
<button
|
||||
onClick={() => {
|
||||
setTheme('light');
|
||||
setThemeOpen(false);
|
||||
}}
|
||||
className={cn(
|
||||
'w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex items-center gap-2',
|
||||
'w-full px-4 py-2 text-left text-sm hover:bg-neutral-100 dark:hover:bg-neutral-700 transition-colors flex items-center gap-2',
|
||||
theme === 'light' &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400',
|
||||
'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-600 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
<Sun className="w-4 h-4" />
|
||||
@ -764,9 +777,9 @@ function HomePage() {
|
||||
setThemeOpen(false);
|
||||
}}
|
||||
className={cn(
|
||||
'w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex items-center gap-2',
|
||||
'w-full px-4 py-2 text-left text-sm hover:bg-neutral-100 dark:hover:bg-neutral-700 transition-colors flex items-center gap-2',
|
||||
theme === 'dark' &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400',
|
||||
'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-600 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
<Moon className="w-4 h-4" />
|
||||
@ -778,9 +791,9 @@ function HomePage() {
|
||||
setThemeOpen(false);
|
||||
}}
|
||||
className={cn(
|
||||
'w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex items-center gap-2',
|
||||
'w-full px-4 py-2 text-left text-sm hover:bg-neutral-100 dark:hover:bg-neutral-700 transition-colors flex items-center gap-2',
|
||||
theme === 'system' &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400',
|
||||
'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-600 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
<Monitor className="w-4 h-4" />
|
||||
@ -790,15 +803,16 @@ function HomePage() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="w-[1px] h-4 bg-gray-200 dark:bg-gray-700" />
|
||||
<div className="w-[1px] h-4 bg-neutral-200 dark:bg-neutral-700" />
|
||||
|
||||
{/* Settings Button */}
|
||||
<div className="relative">
|
||||
<button
|
||||
onClick={() => setSettingsOpen(true)}
|
||||
className="p-2 rounded-full text-gray-400 dark:text-gray-500 hover:bg-white dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 hover:shadow-sm transition-all group"
|
||||
aria-label={t('settings.title')}
|
||||
className="p-2 rounded-full text-neutral-400 dark:text-neutral-500 hover:bg-white dark:hover:bg-neutral-700 hover:text-neutral-800 dark:hover:text-neutral-200 hover:shadow-sm transition-all group"
|
||||
>
|
||||
<Settings className="w-4 h-4 group-hover:rotate-90 transition-transform duration-500" />
|
||||
<Settings className="w-4 h-4 " />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -811,18 +825,6 @@ function HomePage() {
|
||||
initialSection={settingsSection}
|
||||
/>
|
||||
|
||||
{/* ═══ Background Decor ═══ */}
|
||||
<div className="absolute inset-0 overflow-hidden pointer-events-none">
|
||||
<div
|
||||
className="absolute top-0 left-1/4 w-96 h-96 bg-blue-500/10 rounded-full blur-3xl animate-pulse"
|
||||
style={{ animationDuration: '4s' }}
|
||||
/>
|
||||
<div
|
||||
className="absolute bottom-0 right-1/4 w-96 h-96 bg-purple-500/10 rounded-full blur-3xl animate-pulse"
|
||||
style={{ animationDuration: '6s' }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* ═══ Hero section: title + input (centered, wider) ═══ */}
|
||||
<motion.div
|
||||
initial={heroEnter({ opacity: 0, y: 20 })}
|
||||
@ -832,9 +834,7 @@ function HomePage() {
|
||||
>
|
||||
{/* ── Logo ── */}
|
||||
<div className="relative" data-pro-morph="lockup">
|
||||
<motion.img
|
||||
src="/logo-horizontal.png"
|
||||
alt="OpenMAIC"
|
||||
<motion.div
|
||||
initial={heroEnter({ opacity: 0, scale: 0.9 })}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
transition={{
|
||||
@ -843,8 +843,10 @@ function HomePage() {
|
||||
stiffness: 200,
|
||||
damping: 20,
|
||||
}}
|
||||
className="h-12 md:h-16 mb-2 -ml-2 md:-ml-3"
|
||||
/>
|
||||
className="mb-2"
|
||||
>
|
||||
<BrandLogo className="gap-3 text-3xl md:text-4xl" markClassName="size-12 md:size-14" />
|
||||
</motion.div>
|
||||
{workbenchEntryEnabled ? (
|
||||
<div
|
||||
className="absolute left-full top-0 ml-1.5 mt-[10px] md:ml-2 md:mt-[14px]"
|
||||
@ -860,7 +862,7 @@ function HomePage() {
|
||||
initial={heroEnter({ opacity: 0 })}
|
||||
animate={{ opacity: 1 }}
|
||||
transition={{ delay: 0.25 }}
|
||||
className="text-sm text-muted-foreground/60 mb-8"
|
||||
className="text-sm text-muted-foreground mb-8"
|
||||
>
|
||||
{t('home.slogan')}
|
||||
</motion.p>
|
||||
@ -874,7 +876,7 @@ function HomePage() {
|
||||
>
|
||||
<div
|
||||
data-pro-morph="composer"
|
||||
className="w-full rounded-2xl border border-border/60 bg-white/80 dark:bg-slate-900/80 backdrop-blur-xl shadow-xl shadow-black/[0.03] dark:shadow-black/20 transition-shadow focus-within:shadow-2xl focus-within:shadow-violet-500/[0.06]"
|
||||
className="w-full rounded-xl border border-input bg-background shadow-[var(--shadow-prompt)] transition-colors focus-within:border-ring"
|
||||
>
|
||||
{/* ── Greeting + Profile + Agents ── */}
|
||||
<div className="relative z-20 flex items-start justify-between">
|
||||
@ -888,7 +890,7 @@ function HomePage() {
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
placeholder={t('upload.requirementPlaceholder')}
|
||||
className="w-full resize-none border-0 bg-transparent px-4 pt-1 pb-2 text-[13px] leading-relaxed placeholder:text-muted-foreground/40 focus:outline-none min-h-[140px] max-h-[300px]"
|
||||
className="w-full resize-none border-0 bg-transparent px-4 pt-1 pb-2 text-[13px] leading-relaxed placeholder:text-muted-foreground focus:outline-none min-h-[140px] max-h-[300px]"
|
||||
value={form.requirement}
|
||||
onChange={(e) => updateForm('requirement', e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
@ -947,7 +949,7 @@ function HomePage() {
|
||||
'shrink-0 h-8 rounded-lg flex items-center justify-center gap-1.5 transition-all px-3',
|
||||
canGenerate && !preparingGenerate
|
||||
? 'bg-primary text-primary-foreground hover:opacity-90 shadow-sm cursor-pointer'
|
||||
: 'bg-muted text-muted-foreground/40 cursor-not-allowed',
|
||||
: 'bg-muted text-muted-foreground cursor-not-allowed',
|
||||
)}
|
||||
>
|
||||
<span className="text-xs font-medium">
|
||||
@ -1043,7 +1045,7 @@ function HomePage() {
|
||||
path appears/disappears (entering vs leaving a folder). */}
|
||||
<div className="group w-full flex items-center gap-4 h-9">
|
||||
<div className="flex-1 h-px bg-border/40 group-hover:bg-border/70 transition-colors" />
|
||||
<div className="shrink-0 flex items-center gap-3 text-[13px] text-muted-foreground/60 select-none">
|
||||
<div className="shrink-0 flex items-center gap-3 text-[13px] text-muted-foreground select-none">
|
||||
<button
|
||||
onClick={() => {
|
||||
if (currentFolderId) setCurrentFolderId(undefined);
|
||||
@ -1089,7 +1091,7 @@ function HomePage() {
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.12, ease: 'easeOut' }}
|
||||
className="flex items-center justify-center size-6 rounded-full text-muted-foreground/50 hover:text-foreground/70 hover:bg-muted/50 transition-colors cursor-pointer"
|
||||
className="flex items-center justify-center size-6 rounded-full text-muted-foreground hover:text-foreground/70 hover:bg-muted/50 transition-colors cursor-pointer"
|
||||
>
|
||||
<Search className="size-3.5" />
|
||||
</motion.button>
|
||||
@ -1134,7 +1136,7 @@ function HomePage() {
|
||||
}}
|
||||
placeholder={t('classroom.searchPlaceholder')}
|
||||
aria-label={t('classroom.searchAriaLabel')}
|
||||
className="h-7 pl-3 placeholder:text-muted-foreground/50"
|
||||
className="h-7 pl-3 placeholder:text-muted-foreground"
|
||||
/>
|
||||
{searchQuery && (
|
||||
<InputGroupButton
|
||||
@ -1157,7 +1159,7 @@ function HomePage() {
|
||||
<button
|
||||
onClick={triggerImport}
|
||||
disabled={importing}
|
||||
className="group/import grid grid-cols-[auto_0fr] hover:grid-cols-[auto_1fr] items-center gap-1 rounded-full px-1.5 py-0.5 text-[12px] text-muted-foreground/35 hover:text-muted-foreground/70 hover:bg-muted/50 transition-all duration-200 cursor-pointer"
|
||||
className="group/import grid grid-cols-[auto_0fr] hover:grid-cols-[auto_1fr] items-center gap-1 rounded-full px-1.5 py-0.5 text-[12px] text-muted-foreground hover:text-muted-foreground hover:bg-muted/50 transition-all duration-200 cursor-pointer"
|
||||
>
|
||||
<Upload className="size-3" />
|
||||
<span className="overflow-hidden opacity-0 group-hover/import:opacity-100 transition-opacity duration-200 whitespace-nowrap">
|
||||
@ -1168,7 +1170,7 @@ function HomePage() {
|
||||
<button
|
||||
onClick={triggerPptxFileSelect}
|
||||
disabled={pptxImporting}
|
||||
className="group/import-pptx grid grid-cols-[auto_0fr] hover:grid-cols-[auto_1fr] items-center gap-1 rounded-full px-1.5 py-0.5 text-[12px] text-muted-foreground/35 hover:text-muted-foreground/70 hover:bg-muted/50 transition-all duration-200 cursor-pointer"
|
||||
className="group/import-pptx grid grid-cols-[auto_0fr] hover:grid-cols-[auto_1fr] items-center gap-1 rounded-full px-1.5 py-0.5 text-[12px] text-muted-foreground hover:text-muted-foreground hover:bg-muted/50 transition-all duration-200 cursor-pointer"
|
||||
>
|
||||
<Presentation className="size-3" />
|
||||
<span className="overflow-hidden opacity-0 group-hover/import-pptx:opacity-100 transition-opacity duration-200 whitespace-nowrap">
|
||||
@ -1206,7 +1208,7 @@ function HomePage() {
|
||||
className="w-full overflow-hidden"
|
||||
>
|
||||
{folders.length === 0 && classrooms.length === 0 ? (
|
||||
<div className="pt-8 pb-2 text-center text-[13px] text-muted-foreground/60">
|
||||
<div className="pt-8 pb-2 text-center text-[13px] text-muted-foreground">
|
||||
{t('classroom.emptyLibraryHint')}
|
||||
</div>
|
||||
) : !isSearching && currentFolderId && currentFolderClassrooms.length === 0 ? (
|
||||
@ -1217,7 +1219,7 @@ function HomePage() {
|
||||
</p>
|
||||
</div>
|
||||
) : isSearching && filteredClassrooms.length === 0 ? (
|
||||
<div className="pt-8 pb-2 text-center text-[13px] text-muted-foreground/60">
|
||||
<div className="pt-8 pb-2 text-center text-[13px] text-muted-foreground">
|
||||
{t('classroom.searchEmpty')}
|
||||
</div>
|
||||
) : (
|
||||
@ -1312,7 +1314,7 @@ function HomePage() {
|
||||
/>
|
||||
{/* Search view: show the owning folder as a badge. */}
|
||||
{isSearching && classroom.folderId && (
|
||||
<span className="absolute bottom-2 left-2 z-10 inline-flex items-center gap-1 rounded-md bg-violet-500/80 px-1.5 py-0.5 text-[10px] font-medium text-white backdrop-blur-sm pointer-events-none">
|
||||
<span className="absolute bottom-2 left-2 z-10 inline-flex items-center gap-1 rounded-md bg-neutral-500/80 px-1.5 py-0.5 text-[10px] font-medium text-white backdrop-blur-sm pointer-events-none">
|
||||
<Folder className="size-2.5" />
|
||||
{folderNameById.get(classroom.folderId) ?? ''}
|
||||
</span>
|
||||
@ -1345,8 +1347,8 @@ function HomePage() {
|
||||
/>
|
||||
|
||||
{/* Footer — flows with content, at the very end */}
|
||||
<div className="mt-auto pt-12 pb-4 text-center text-xs text-muted-foreground/40">
|
||||
OpenMAIC Open Source Project
|
||||
<div className="mt-auto pt-12 pb-4 text-center text-xs text-muted-foreground">
|
||||
{DEFAULT_BRAND.productName}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@ -1447,15 +1449,15 @@ function GreetingBar() {
|
||||
{/* ── Collapsed pill (always in flow) ── */}
|
||||
{!open && (
|
||||
<div
|
||||
className="flex items-center gap-2.5 cursor-pointer transition-all duration-200 group rounded-full px-2.5 py-1.5 border border-border/50 text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 active:scale-[0.97]"
|
||||
className="flex items-center gap-2.5 cursor-pointer transition-all duration-200 group rounded-full px-2.5 py-1.5 border border-border/50 text-muted-foreground hover:text-foreground hover:bg-muted/60 active:scale-[0.97]"
|
||||
onClick={() => setOpen(true)}
|
||||
>
|
||||
<div className="shrink-0 relative">
|
||||
<div className="size-8 rounded-full overflow-hidden ring-[1.5px] ring-border/30 group-hover:ring-violet-400/60 dark:group-hover:ring-violet-400/40 transition-all duration-300">
|
||||
<div className="size-8 rounded-full overflow-hidden ring-[1.5px] ring-border/30 group-hover:ring-neutral-400/60 dark:group-hover:ring-neutral-400/40 transition-all duration-300">
|
||||
<img src={avatar} alt="" className="size-full object-cover" />
|
||||
</div>
|
||||
<div className="absolute -bottom-0.5 -right-0.5 size-3.5 rounded-full bg-white dark:bg-slate-800 border border-border/40 flex items-center justify-center opacity-60 group-hover:opacity-100 transition-opacity">
|
||||
<Pencil className="size-[7px] text-muted-foreground/70" />
|
||||
<div className="absolute -bottom-0.5 -right-0.5 size-3.5 rounded-full bg-white dark:bg-neutral-800 border border-border/40 flex items-center justify-center opacity-60 group-hover:opacity-100 transition-opacity">
|
||||
<Pencil className="size-[7px] text-muted-foreground" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
@ -1465,7 +1467,7 @@ function GreetingBar() {
|
||||
<span className="text-[13px] font-semibold text-foreground/85 group-hover:text-foreground transition-colors">
|
||||
{t('home.greetingWithName', { name: displayName })}
|
||||
</span>
|
||||
<ChevronDown className="size-3 text-muted-foreground/30 group-hover:text-muted-foreground/60 transition-colors shrink-0" />
|
||||
<ChevronDown className="size-3 text-muted-foreground group-hover:text-muted-foreground transition-colors shrink-0" />
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom" sideOffset={4}>
|
||||
@ -1486,7 +1488,7 @@ function GreetingBar() {
|
||||
transition={{ duration: 0.2, ease: [0.25, 0.1, 0.25, 1] }}
|
||||
className="absolute left-4 top-3.5 z-50 w-64"
|
||||
>
|
||||
<div className="rounded-2xl bg-white/95 dark:bg-slate-800/95 backdrop-blur-sm ring-1 ring-black/[0.04] dark:ring-white/[0.06] shadow-[0_1px_8px_-2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_8px_-2px_rgba(0,0,0,0.3)] px-2.5 py-2">
|
||||
<div className="rounded-2xl bg-white/95 dark:bg-neutral-800/95 backdrop-blur-sm ring-1 ring-black/[0.04] dark:ring-white/[0.06] shadow-[0_1px_8px_-2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_8px_-2px_rgba(0,0,0,0.3)] px-2.5 py-2">
|
||||
{/* ── Row: avatar + name ── */}
|
||||
<div
|
||||
className="flex items-center gap-2.5 cursor-pointer transition-all duration-200"
|
||||
@ -1504,17 +1506,17 @@ function GreetingBar() {
|
||||
setAvatarPickerOpen(!avatarPickerOpen);
|
||||
}}
|
||||
>
|
||||
<div className="size-8 rounded-full overflow-hidden ring-[1.5px] ring-violet-300/70 dark:ring-violet-500/40 transition-all duration-300">
|
||||
<div className="size-8 rounded-full overflow-hidden ring-[1.5px] ring-neutral-300/70 dark:ring-neutral-500/40 transition-all duration-300">
|
||||
<img src={avatar} alt="" className="size-full object-cover" />
|
||||
</div>
|
||||
<motion.div
|
||||
initial={{ scale: 0 }}
|
||||
animate={{ scale: 1 }}
|
||||
className="absolute -bottom-0.5 -right-0.5 size-3.5 rounded-full bg-white dark:bg-slate-800 border border-border/60 flex items-center justify-center"
|
||||
className="absolute -bottom-0.5 -right-0.5 size-3.5 rounded-full bg-white dark:bg-neutral-800 border border-border/60 flex items-center justify-center"
|
||||
>
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
'size-2 text-muted-foreground/70 transition-transform duration-200',
|
||||
'size-2 text-muted-foreground transition-transform duration-200',
|
||||
avatarPickerOpen && 'rotate-180',
|
||||
)}
|
||||
/>
|
||||
@ -1538,11 +1540,11 @@ function GreetingBar() {
|
||||
onBlur={commitName}
|
||||
maxLength={20}
|
||||
placeholder={t('profile.defaultNickname')}
|
||||
className="flex-1 min-w-0 h-6 bg-transparent border-b border-border/80 text-[13px] font-semibold text-foreground outline-none placeholder:text-muted-foreground/40"
|
||||
className="flex-1 min-w-0 h-6 bg-transparent border-b border-border/80 text-[13px] font-semibold text-foreground outline-none placeholder:text-muted-foreground"
|
||||
/>
|
||||
<button
|
||||
onClick={commitName}
|
||||
className="shrink-0 size-5 rounded flex items-center justify-center text-violet-500 hover:bg-violet-100 dark:hover:bg-violet-900/30"
|
||||
className="shrink-0 size-5 rounded flex items-center justify-center text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-900/30"
|
||||
>
|
||||
<Check className="size-3" />
|
||||
</button>
|
||||
@ -1558,7 +1560,7 @@ function GreetingBar() {
|
||||
<span className="text-[13px] font-semibold text-foreground/85 group-hover/name:text-foreground transition-colors">
|
||||
{displayName}
|
||||
</span>
|
||||
<Pencil className="size-2.5 text-muted-foreground/30 opacity-0 group-hover/name:opacity-100 transition-opacity" />
|
||||
<Pencil className="size-2.5 text-muted-foreground opacity-0 group-hover/name:opacity-100 transition-opacity" />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@ -1569,7 +1571,7 @@ function GreetingBar() {
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="shrink-0 size-6 rounded-full flex items-center justify-center hover:bg-black/[0.04] dark:hover:bg-white/[0.06] transition-colors"
|
||||
>
|
||||
<ChevronUp className="size-3.5 text-muted-foreground/50" />
|
||||
<ChevronUp className="size-3.5 text-muted-foreground" />
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
@ -1591,10 +1593,10 @@ function GreetingBar() {
|
||||
key={url}
|
||||
onClick={() => setAvatar(url)}
|
||||
className={cn(
|
||||
'size-7 rounded-full overflow-hidden bg-gray-50 dark:bg-gray-800 cursor-pointer transition-all duration-150',
|
||||
'size-7 rounded-full overflow-hidden bg-neutral-50 dark:bg-neutral-800 cursor-pointer transition-all duration-150',
|
||||
'hover:scale-110 active:scale-95',
|
||||
avatar === url
|
||||
? 'ring-2 ring-violet-400 dark:ring-violet-500 ring-offset-0'
|
||||
? 'ring-2 ring-neutral-400 dark:ring-neutral-500 ring-offset-0'
|
||||
: 'hover:ring-1 hover:ring-muted-foreground/30',
|
||||
)}
|
||||
>
|
||||
@ -1606,8 +1608,8 @@ function GreetingBar() {
|
||||
'size-7 rounded-full flex items-center justify-center cursor-pointer transition-all duration-150 border border-dashed',
|
||||
'hover:scale-110 active:scale-95',
|
||||
isCustomAvatar(avatar)
|
||||
? 'ring-2 ring-violet-400 dark:ring-violet-500 ring-offset-0 border-violet-300 dark:border-violet-600 bg-violet-50 dark:bg-violet-900/30'
|
||||
: 'border-muted-foreground/30 text-muted-foreground/50 hover:border-muted-foreground/50',
|
||||
? 'ring-2 ring-neutral-400 dark:ring-neutral-500 ring-offset-0 border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-900/30'
|
||||
: 'border-muted-foreground/30 text-muted-foreground hover:border-muted-foreground/50',
|
||||
)}
|
||||
onClick={() => avatarInputRef.current?.click()}
|
||||
title={t('profile.uploadAvatar')}
|
||||
@ -1721,7 +1723,7 @@ function ClassroomCard({
|
||||
{/* Thumbnail — large radius, no border, subtle bg */}
|
||||
<div
|
||||
ref={thumbRef}
|
||||
className="relative w-full aspect-[16/9] rounded-2xl bg-slate-100 dark:bg-slate-800/80 overflow-hidden transition-transform duration-200 group-hover:scale-[1.02]"
|
||||
className="relative w-full aspect-[16/9] rounded-lg border border-border bg-field overflow-hidden transition-colors group-hover:border-input"
|
||||
>
|
||||
{slide && thumbWidth > 0 ? (
|
||||
<SlideThumbnail
|
||||
@ -1732,7 +1734,7 @@ function ClassroomCard({
|
||||
/>
|
||||
) : !slide ? (
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<div className="size-12 rounded-2xl bg-gradient-to-br from-violet-100 to-blue-100 dark:from-violet-900/30 dark:to-blue-900/30 flex items-center justify-center">
|
||||
<div className="size-12 rounded-2xl bg-brand-muted text-brand flex items-center justify-center">
|
||||
<span className="text-xl opacity-50">📄</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1745,7 +1747,7 @@ function ClassroomCard({
|
||||
aria-label={modeBadgeLabel}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className={cn(
|
||||
'absolute bottom-2 left-2 inline-flex items-center justify-center size-5 rounded-full bg-white/70 dark:bg-slate-900/60 backdrop-blur-sm shadow-sm z-10',
|
||||
'absolute bottom-2 left-2 inline-flex items-center justify-center size-5 rounded-full bg-white/70 dark:bg-neutral-900/60 backdrop-blur-sm shadow-sm z-10',
|
||||
isTaskEngineMode
|
||||
? 'text-amber-600 dark:text-amber-300 ring-1 ring-amber-500/35'
|
||||
: 'text-cyan-600 dark:text-cyan-300 ring-1 ring-cyan-500/30',
|
||||
@ -1836,7 +1838,7 @@ function ClassroomCard({
|
||||
|
||||
{/* Info — outside the thumbnail */}
|
||||
<div className="mt-2.5 px-1 flex items-center gap-2">
|
||||
<span className="shrink-0 inline-flex items-center rounded-full bg-violet-100 dark:bg-violet-900/30 px-2 py-0.5 text-[11px] font-medium text-violet-600 dark:text-violet-400">
|
||||
<span className="shrink-0 inline-flex items-center rounded-full bg-neutral-100 dark:bg-neutral-900/30 px-2 py-0.5 text-[11px] font-medium text-neutral-600 dark:text-neutral-400">
|
||||
{classroom.sceneCount} {t('classroom.slides')} · {formatDate(classroom.updatedAt)}
|
||||
</span>
|
||||
{editing ? (
|
||||
@ -1852,7 +1854,7 @@ function ClassroomCard({
|
||||
onBlur={commitRename}
|
||||
maxLength={100}
|
||||
placeholder={t('classroom.renamePlaceholder')}
|
||||
className="w-full bg-transparent border-b border-violet-400/60 text-[15px] font-medium text-foreground/90 outline-none placeholder:text-muted-foreground/40"
|
||||
className="w-full bg-transparent border-b border-neutral-400/60 text-[15px] font-medium text-foreground/90 outline-none placeholder:text-muted-foreground"
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { DEFAULT_BRAND } from '@/lib/brand/brand-config';
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
import { motion, AnimatePresence } from 'motion/react';
|
||||
import { useI18n } from '@/lib/hooks/use-i18n';
|
||||
@ -118,7 +119,7 @@ export function AccessCodeModal({ open, onSuccess }: AccessCodeModalProps) {
|
||||
animate={{ opacity: 1 }}
|
||||
transition={{ delay: 0.25, duration: 0.4 }}
|
||||
>
|
||||
OpenMAIC
|
||||
{DEFAULT_BRAND.productName}
|
||||
</motion.p>
|
||||
|
||||
{/* Form */}
|
||||
|
||||
@ -206,7 +206,7 @@ function AgentVoicePill({
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
className="flex items-center gap-1.5 h-6 w-[100px] rounded-full bg-muted/40 px-2.5 text-[11px] text-muted-foreground/30 shrink-0 cursor-not-allowed"
|
||||
className="flex items-center gap-1.5 h-6 w-[100px] rounded-full bg-muted/40 px-2.5 text-[11px] text-muted-foreground shrink-0 cursor-not-allowed"
|
||||
>
|
||||
<VolumeX className="size-3 shrink-0" />
|
||||
<span className="truncate flex-1 text-left">{displayName}</span>
|
||||
@ -247,27 +247,27 @@ function AgentVoicePill({
|
||||
>
|
||||
<div className="border-b border-border/50 p-2">
|
||||
<div className="relative">
|
||||
<Search className="pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/50" />
|
||||
<Search className="pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" />
|
||||
<input
|
||||
value={voiceQuery}
|
||||
onChange={(e) => setVoiceQuery(e.target.value)}
|
||||
autoFocus
|
||||
aria-label={t('agentBar.searchVoice')}
|
||||
placeholder={t('agentBar.searchVoice')}
|
||||
className="h-8 w-full rounded-md border border-input bg-background pl-8 pr-3 text-sm outline-none transition-colors placeholder:text-muted-foreground/50 focus:border-primary/50 focus:ring-2 focus:ring-primary/10"
|
||||
className="h-8 w-full rounded-md border border-input bg-background pl-8 pr-3 text-sm outline-none transition-colors placeholder:text-muted-foreground focus:border-primary/50 focus:ring-2 focus:ring-primary/10"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="max-h-80 overflow-y-auto p-1">
|
||||
{visibleProviderGroups.length === 0 && (
|
||||
<div className="px-3 py-6 text-center text-sm text-muted-foreground/60">
|
||||
<div className="px-3 py-6 text-center text-sm text-muted-foreground">
|
||||
{t('agentBar.noMatchingVoices')}
|
||||
</div>
|
||||
)}
|
||||
{visibleProviderGroups.map(({ provider, groups }) =>
|
||||
groups.map((group) => (
|
||||
<div key={`${provider.providerId}::${group.modelId}`}>
|
||||
<div className="sticky top-0 bg-popover px-2 py-1 text-[11px] font-medium text-muted-foreground/60">
|
||||
<div className="sticky top-0 bg-popover px-2 py-1 text-[11px] font-medium text-muted-foreground">
|
||||
{group.modelId
|
||||
? `${provider.providerName} · ${group.modelName}`
|
||||
: provider.providerName}
|
||||
@ -321,7 +321,7 @@ function AgentVoicePill({
|
||||
'flex size-6 shrink-0 items-center justify-center rounded-sm transition-colors',
|
||||
isPreviewing
|
||||
? 'text-primary'
|
||||
: 'text-muted-foreground/40 hover:text-muted-foreground',
|
||||
: 'text-muted-foreground hover:text-muted-foreground',
|
||||
)}
|
||||
>
|
||||
{isPreviewing ? (
|
||||
@ -476,7 +476,7 @@ function TeacherVoicePill({
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
className="flex items-center gap-1.5 h-6 w-[100px] rounded-full bg-muted/40 px-2.5 text-[11px] text-muted-foreground/30 shrink-0 cursor-not-allowed"
|
||||
className="flex items-center gap-1.5 h-6 w-[100px] rounded-full bg-muted/40 px-2.5 text-[11px] text-muted-foreground shrink-0 cursor-not-allowed"
|
||||
>
|
||||
<VolumeX className="size-3 shrink-0" />
|
||||
<span className="truncate flex-1 text-left">{displayName}</span>
|
||||
@ -517,27 +517,27 @@ function TeacherVoicePill({
|
||||
>
|
||||
<div className="border-b border-border/50 p-2">
|
||||
<div className="relative">
|
||||
<Search className="pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/50" />
|
||||
<Search className="pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" />
|
||||
<input
|
||||
value={voiceQuery}
|
||||
onChange={(e) => setVoiceQuery(e.target.value)}
|
||||
autoFocus
|
||||
aria-label={t('agentBar.searchVoice')}
|
||||
placeholder={t('agentBar.searchVoice')}
|
||||
className="h-8 w-full rounded-md border border-input bg-background pl-8 pr-3 text-sm outline-none transition-colors placeholder:text-muted-foreground/50 focus:border-primary/50 focus:ring-2 focus:ring-primary/10"
|
||||
className="h-8 w-full rounded-md border border-input bg-background pl-8 pr-3 text-sm outline-none transition-colors placeholder:text-muted-foreground focus:border-primary/50 focus:ring-2 focus:ring-primary/10"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="max-h-80 overflow-y-auto p-1">
|
||||
{visibleProviderGroups.length === 0 && (
|
||||
<div className="px-3 py-6 text-center text-sm text-muted-foreground/60">
|
||||
<div className="px-3 py-6 text-center text-sm text-muted-foreground">
|
||||
{t('agentBar.noMatchingVoices')}
|
||||
</div>
|
||||
)}
|
||||
{visibleProviderGroups.map(({ provider, groups }) =>
|
||||
groups.map((group) => (
|
||||
<div key={`${provider.providerId}::${group.modelId}`}>
|
||||
<div className="sticky top-0 bg-popover px-2 py-1 text-[11px] font-medium text-muted-foreground/60">
|
||||
<div className="sticky top-0 bg-popover px-2 py-1 text-[11px] font-medium text-muted-foreground">
|
||||
{group.modelId
|
||||
? `${provider.providerName} · ${group.modelName}`
|
||||
: provider.providerName}
|
||||
@ -589,7 +589,7 @@ function TeacherVoicePill({
|
||||
'flex size-6 shrink-0 items-center justify-center rounded-sm transition-colors',
|
||||
isPreviewing
|
||||
? 'text-primary'
|
||||
: 'text-muted-foreground/40 hover:text-muted-foreground',
|
||||
: 'text-muted-foreground hover:text-muted-foreground',
|
||||
)}
|
||||
>
|
||||
{isPreviewing ? (
|
||||
@ -742,7 +742,7 @@ export function AgentBar() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<Shuffle className="size-4 text-violet-400 dark:text-violet-500" />
|
||||
<Shuffle className="size-4 text-neutral-400 dark:text-neutral-500" />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
@ -772,9 +772,9 @@ export function AgentBar() {
|
||||
</>
|
||||
)}
|
||||
{ttsEnabled ? (
|
||||
<Volume2 className="size-3.5 text-muted-foreground/40 group-hover:text-muted-foreground/60 transition-colors" />
|
||||
<Volume2 className="size-3.5 text-muted-foreground group-hover:text-muted-foreground transition-colors" />
|
||||
) : (
|
||||
<VolumeX className="size-3.5 text-muted-foreground/30" />
|
||||
<VolumeX className="size-3.5 text-muted-foreground" />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
@ -806,7 +806,7 @@ export function AgentBar() {
|
||||
<span className="text-[13px] font-medium truncate min-w-0 flex-1">
|
||||
{getAgentName(agent)}
|
||||
</span>
|
||||
<span className="text-[10px] text-muted-foreground/50 shrink-0 w-[52px] text-right">
|
||||
<span className="text-[10px] text-muted-foreground shrink-0 w-[52px] text-right">
|
||||
{getAgentRole(agent)}
|
||||
</span>
|
||||
<AgentVoicePill
|
||||
@ -826,18 +826,18 @@ export function AgentBar() {
|
||||
<button
|
||||
className={cn(
|
||||
'group flex items-center gap-2 cursor-pointer rounded-full px-2.5 py-2 transition-all w-full',
|
||||
'border border-border/50 text-muted-foreground/70 hover:text-foreground hover:bg-muted/60',
|
||||
'border border-border/50 text-muted-foreground hover:text-foreground hover:bg-muted/60',
|
||||
)}
|
||||
onClick={() => setOpen(!open)}
|
||||
>
|
||||
<span className="text-xs text-muted-foreground/60 group-hover:text-muted-foreground transition-colors hidden sm:block font-medium flex-1 text-left truncate">
|
||||
<span className="text-xs text-muted-foreground group-hover:text-muted-foreground transition-colors hidden sm:block font-medium flex-1 text-left truncate">
|
||||
{open ? t('agentBar.expandedTitle') : t('agentBar.readyToLearn')}
|
||||
</span>
|
||||
{avatarRow}
|
||||
{open ? (
|
||||
<ChevronUp className="size-3 text-muted-foreground/40 group-hover:text-muted-foreground/70 transition-colors" />
|
||||
<ChevronUp className="size-3 text-muted-foreground group-hover:text-muted-foreground transition-colors" />
|
||||
) : (
|
||||
<ChevronDown className="size-3 text-muted-foreground/40 group-hover:text-muted-foreground/70 transition-colors" />
|
||||
<ChevronDown className="size-3 text-muted-foreground group-hover:text-muted-foreground transition-colors" />
|
||||
)}
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
@ -857,7 +857,7 @@ export function AgentBar() {
|
||||
transition={{ duration: 0.2, ease: [0.25, 0.1, 0.25, 1] }}
|
||||
className="absolute right-0 top-full mt-1 z-50 w-96"
|
||||
>
|
||||
<div className="rounded-2xl bg-white/95 dark:bg-slate-800/95 backdrop-blur-sm ring-1 ring-black/[0.04] dark:ring-white/[0.06] shadow-[0_1px_8px_-2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_8px_-2px_rgba(0,0,0,0.3)] px-2 py-1.5">
|
||||
<div className="rounded-2xl bg-white/95 dark:bg-neutral-800/95 backdrop-blur-sm ring-1 ring-black/[0.04] dark:ring-white/[0.06] shadow-[0_1px_8px_-2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_8px_-2px_rgba(0,0,0,0.3)] px-2 py-1.5">
|
||||
{/* Teacher — always visible */}
|
||||
{teacherAgent && (
|
||||
<div className="flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-primary/5 mb-2">
|
||||
@ -917,16 +917,16 @@ export function AgentBar() {
|
||||
) : (
|
||||
<div className="flex flex-col items-center pt-6 pb-3 gap-4">
|
||||
<div className="relative flex items-center justify-center">
|
||||
<div className="absolute size-10 rounded-full bg-violet-400/10 dark:bg-violet-400/15 animate-ping [animation-duration:3s]" />
|
||||
<div className="absolute size-12 rounded-full bg-violet-400/5 dark:bg-violet-400/10 animate-pulse [animation-duration:2.5s]" />
|
||||
<Shuffle className="relative size-5 text-violet-400 dark:text-violet-500" />
|
||||
<div className="absolute size-10 rounded-full bg-neutral-400/10 dark:bg-neutral-400/15 animate-ping [animation-duration:3s]" />
|
||||
<div className="absolute size-12 rounded-full bg-neutral-400/5 dark:bg-neutral-400/10 animate-pulse [animation-duration:2.5s]" />
|
||||
<Shuffle className="relative size-5 text-neutral-400 dark:text-neutral-500" />
|
||||
</div>
|
||||
<div className="flex-1" />
|
||||
<div className="text-center space-y-1">
|
||||
<p className="text-[11px] text-muted-foreground/60">
|
||||
<p className="text-[11px] text-muted-foreground">
|
||||
{t('settings.agentModeAutoDesc')}
|
||||
</p>
|
||||
<p className="text-[10px] text-muted-foreground/40">
|
||||
<p className="text-[10px] text-muted-foreground">
|
||||
{t('agentBar.voiceAutoAssign')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -95,7 +95,7 @@ export function SpeechButton({
|
||||
'relative flex items-center justify-center rounded-lg transition-all duration-200 shrink-0 cursor-pointer',
|
||||
sizeClasses,
|
||||
active
|
||||
? 'bg-violet-500/90 dark:bg-violet-600/80 text-white shadow-[0_0_12px_rgba(139,92,246,0.45)] dark:shadow-[0_0_12px_rgba(139,92,246,0.3)]'
|
||||
? 'bg-primary text-primary-foreground'
|
||||
: 'text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/80',
|
||||
isDisabled && 'opacity-40 pointer-events-none',
|
||||
className,
|
||||
@ -104,7 +104,7 @@ export function SpeechButton({
|
||||
{/* Breathing ring when recording */}
|
||||
{isRecording && (
|
||||
<span
|
||||
className="absolute inset-[-4px] rounded-[10px] border border-violet-400/40 dark:border-violet-400/25"
|
||||
className="absolute inset-[-4px] rounded-[10px] border border-neutral-400/40 dark:border-neutral-400/25"
|
||||
style={{
|
||||
animation: 'speech-ring 2s ease-in-out infinite',
|
||||
}}
|
||||
|
||||
32
components/brand-logo.tsx
Normal file
32
components/brand-logo.tsx
Normal file
@ -0,0 +1,32 @@
|
||||
'use client';
|
||||
|
||||
import type { ComponentProps } from 'react';
|
||||
import { useBrand } from '@/lib/brand/brand-context';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
/** Shared product lockup. The supplied logo stays unmodified on a white tile. */
|
||||
export function BrandLogo({
|
||||
className,
|
||||
markClassName,
|
||||
...props
|
||||
}: ComponentProps<'span'> & {
|
||||
markClassName?: string;
|
||||
}) {
|
||||
const brand = useBrand();
|
||||
return (
|
||||
<span
|
||||
{...props}
|
||||
className={cn(
|
||||
'inline-flex shrink-0 items-center gap-2 whitespace-nowrap text-sm font-semibold tracking-tight text-foreground',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<img
|
||||
src={brand.logoSrc}
|
||||
alt={brand.logoHasWordmark ? brand.productName : ''}
|
||||
className={cn('size-7 shrink-0 rounded-md bg-white p-0.5 object-contain', markClassName)}
|
||||
/>
|
||||
{!brand.logoHasWordmark && <span>{brand.productName}</span>}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@ -97,25 +97,25 @@ export function CanvasArea({
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="w-full h-full flex flex-col bg-gray-50 dark:bg-gray-900 group/canvas">
|
||||
<div className="w-full h-full flex flex-col bg-neutral-50 dark:bg-neutral-900 group/canvas">
|
||||
{/* Slide area — takes remaining space */}
|
||||
<div
|
||||
className={cn(
|
||||
'flex-1 min-h-0 relative overflow-hidden flex items-center justify-center p-2 transition-colors duration-500',
|
||||
currentScene?.type === 'interactive'
|
||||
? 'bg-blue-50/30 dark:bg-blue-900/10'
|
||||
: 'bg-gray-50/30 dark:bg-gray-900/30',
|
||||
: 'bg-neutral-50/30 dark:bg-neutral-900/30',
|
||||
)}
|
||||
>
|
||||
<StageViewport
|
||||
workbench={inWorkbenchPanel}
|
||||
interactive={currentScene?.type === 'interactive'}
|
||||
className={cn(
|
||||
'bg-white dark:bg-gray-800 shadow-2xl rounded-lg overflow-hidden relative transition-all duration-700',
|
||||
'bg-white dark:bg-neutral-800 shadow-2xl rounded-lg overflow-hidden relative transition-all duration-700',
|
||||
showControls && !isLiveSession && currentScene?.type === 'slide' && 'cursor-pointer',
|
||||
currentScene?.type === 'interactive'
|
||||
? 'shadow-blue-200/50 dark:shadow-blue-900/50 ring-1 ring-blue-900/5 dark:ring-blue-500/10'
|
||||
: 'shadow-gray-200/50 dark:shadow-gray-800/50 ring-1 ring-gray-950/5 dark:ring-white/5',
|
||||
: 'shadow-neutral-200/50 dark:shadow-neutral-800/50 ring-1 ring-neutral-950/5 dark:ring-white/5',
|
||||
)}
|
||||
onClick={handleSlideClick}
|
||||
>
|
||||
@ -167,7 +167,7 @@ export function CanvasArea({
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.4, ease: 'easeOut' }}
|
||||
className="absolute inset-0 z-[105] flex flex-col items-center justify-center bg-white dark:bg-gray-800"
|
||||
className="absolute inset-0 z-[105] flex flex-col items-center justify-center bg-white dark:bg-neutral-800"
|
||||
>
|
||||
{isGenerationFailed ? (
|
||||
<div className="flex flex-col items-center gap-3">
|
||||
@ -202,15 +202,15 @@ export function CanvasArea({
|
||||
<div className="flex flex-col items-center gap-4">
|
||||
{/* Spinner */}
|
||||
<div className="relative w-12 h-12">
|
||||
<div className="absolute inset-0 rounded-full border-2 border-gray-100 dark:border-gray-700" />
|
||||
<div className="absolute inset-0 rounded-full border-2 border-transparent border-t-purple-500 dark:border-t-purple-400 animate-spin" />
|
||||
<div className="absolute inset-0 rounded-full border-2 border-neutral-100 dark:border-neutral-700" />
|
||||
<div className="absolute inset-0 rounded-full border-2 border-transparent border-t-neutral-500 dark:border-t-neutral-400 animate-spin" />
|
||||
</div>
|
||||
{/* Text */}
|
||||
<motion.span
|
||||
initial={{ opacity: 0, y: 4 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: 0.2, duration: 0.3 }}
|
||||
className="text-sm text-gray-400 dark:text-gray-500 font-medium"
|
||||
className="text-sm text-neutral-400 dark:text-neutral-500 font-medium"
|
||||
>
|
||||
{t('stage.generatingNextPage')}
|
||||
</motion.span>
|
||||
@ -222,7 +222,7 @@ export function CanvasArea({
|
||||
|
||||
{/* Scene Number Badge */}
|
||||
{currentScene && (
|
||||
<div className="absolute top-4 right-4 text-gray-200 dark:text-gray-700 font-black text-4xl opacity-50 pointer-events-none select-none mix-blend-multiply dark:mix-blend-screen">
|
||||
<div className="absolute top-4 right-4 text-neutral-200 dark:text-neutral-700 font-black text-4xl opacity-50 pointer-events-none select-none mix-blend-multiply dark:mix-blend-screen">
|
||||
{(currentSceneIndex + 1).toString().padStart(2, '0')}
|
||||
</div>
|
||||
)}
|
||||
@ -258,10 +258,10 @@ export function CanvasArea({
|
||||
ease: 'easeInOut',
|
||||
},
|
||||
}}
|
||||
className="w-20 h-20 rounded-full bg-white/95 dark:bg-gray-800/95 flex items-center justify-center shadow-[0_4px_30px_rgba(147,51,234,0.15),inset_0_0_0_1px_rgba(233,213,255,0.5)] dark:shadow-[0_4px_30px_rgba(147,51,234,0.3),inset_0_0_0_1px_rgba(126,34,206,0.3)]"
|
||||
className="w-20 h-20 rounded-full bg-primary text-primary-foreground flex items-center justify-center shadow-[var(--shadow-floating)]"
|
||||
style={{ willChange: 'transform' }}
|
||||
>
|
||||
<Play className="w-7 h-7 text-purple-600 dark:text-purple-400 fill-purple-600/90 dark:fill-purple-400/90 ml-0.5" />
|
||||
<Play className="w-7 h-7 text-primary-foreground fill-current ml-0.5" />
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
@ -273,11 +273,7 @@ export function CanvasArea({
|
||||
{/* ── Canvas Toolbar — in document flow, only when not merged into roundtable ── */}
|
||||
{!hideToolbar && (
|
||||
<CanvasToolbar
|
||||
className={cn(
|
||||
'shrink-0 h-9 px-2',
|
||||
'bg-white/80 dark:bg-gray-800/80 backdrop-blur-xl',
|
||||
'border-t border-gray-200/40 dark:border-gray-700/40',
|
||||
)}
|
||||
className={cn('shrink-0 h-9 px-2', 'bg-background', 'border-t border-border')}
|
||||
currentSceneIndex={currentSceneIndex}
|
||||
scenesCount={scenesCount}
|
||||
engineState={engineState}
|
||||
|
||||
@ -65,12 +65,12 @@ export interface CanvasToolbarProps {
|
||||
const ctrlBtn = cn(
|
||||
'relative w-7 h-7 rounded-md flex items-center justify-center',
|
||||
'transition-all duration-150 outline-none cursor-pointer',
|
||||
'hover:bg-gray-500/[0.08] dark:hover:bg-gray-400/[0.08] active:scale-90',
|
||||
'hover:bg-neutral-500/[0.08] dark:hover:bg-neutral-400/[0.08] active:scale-90',
|
||||
);
|
||||
|
||||
/* Subtle separator */
|
||||
function CtrlDivider() {
|
||||
return <div className="w-px h-3 bg-gray-200/80 dark:bg-gray-700/60 mx-0.5 shrink-0" />;
|
||||
return <div className="w-px h-3 bg-neutral-200/80 dark:bg-neutral-700/60 mx-0.5 shrink-0" />;
|
||||
}
|
||||
|
||||
/* Volume icon based on level */
|
||||
@ -167,15 +167,15 @@ export function CanvasToolbar({
|
||||
ctrlBtn,
|
||||
'w-6 h-6',
|
||||
sidebarCollapsed
|
||||
? 'text-gray-400 dark:text-gray-500'
|
||||
: 'text-gray-600 dark:text-gray-300',
|
||||
? 'text-neutral-400 dark:text-neutral-500'
|
||||
: 'text-neutral-600 dark:text-neutral-300',
|
||||
)}
|
||||
aria-label="Toggle sidebar"
|
||||
>
|
||||
<LayoutList className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
)}
|
||||
<span className="text-[11px] text-gray-400 dark:text-gray-500 tabular-nums select-none font-medium">
|
||||
<span className="text-[11px] text-neutral-400 dark:text-neutral-500 tabular-nums select-none font-medium">
|
||||
{currentSceneIndex + 1}
|
||||
<span className="opacity-35 mx-px">/</span>
|
||||
{scenesCount}
|
||||
@ -191,7 +191,7 @@ export function CanvasToolbar({
|
||||
'inline-flex items-center gap-0.5 px-1 h-7',
|
||||
isPresenting
|
||||
? '' /* Single visual layer in fullscreen — buttons sit inside outer pill directly */
|
||||
: 'bg-gray-100/60 dark:bg-gray-800/60 rounded-lg',
|
||||
: 'bg-neutral-100/60 dark:bg-neutral-800/60 rounded-lg',
|
||||
)}
|
||||
>
|
||||
{/* Volume with vertical popover slider */}
|
||||
@ -209,10 +209,10 @@ export function CanvasToolbar({
|
||||
ctrlBtn,
|
||||
'w-6 h-6',
|
||||
!ttsEnabled
|
||||
? 'text-gray-300 dark:text-gray-600 cursor-not-allowed'
|
||||
? 'text-neutral-300 dark:text-neutral-600 cursor-not-allowed'
|
||||
: ttsMuted
|
||||
? 'text-red-500 dark:text-red-400'
|
||||
: 'text-gray-500 dark:text-gray-400',
|
||||
: 'text-neutral-500 dark:text-neutral-400',
|
||||
)}
|
||||
aria-label={ttsMuted ? 'Unmute' : 'Mute'}
|
||||
>
|
||||
@ -227,8 +227,8 @@ export function CanvasToolbar({
|
||||
volumeHover && ttsEnabled && 'pointer-events-auto opacity-100',
|
||||
)}
|
||||
>
|
||||
<div className="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg px-2 py-2.5 flex flex-col items-center gap-1.5">
|
||||
<span className="text-[10px] text-gray-400 dark:text-gray-500 tabular-nums font-medium select-none">
|
||||
<div className="bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg px-2 py-2.5 flex flex-col items-center gap-1.5">
|
||||
<span className="text-[10px] text-neutral-400 dark:text-neutral-500 tabular-nums font-medium select-none">
|
||||
{Math.round(effectiveVolume * 100)}
|
||||
</span>
|
||||
<input
|
||||
@ -245,18 +245,18 @@ export function CanvasToolbar({
|
||||
className={cn(
|
||||
'appearance-none cursor-pointer',
|
||||
'h-16 w-1 rounded-full',
|
||||
'bg-gray-200 dark:bg-gray-600',
|
||||
'bg-neutral-200 dark:bg-neutral-600',
|
||||
'[writing-mode:vertical-lr] [direction:rtl]',
|
||||
'[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3',
|
||||
'[&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-violet-500 [&::-webkit-slider-thumb]:dark:bg-violet-400',
|
||||
'[&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-neutral-500 [&::-webkit-slider-thumb]:dark:bg-neutral-400',
|
||||
'[&::-webkit-slider-thumb]:shadow-sm [&::-webkit-slider-thumb]:cursor-pointer',
|
||||
'[&::-moz-range-thumb]:w-3 [&::-moz-range-thumb]:h-3',
|
||||
'[&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-violet-500 [&::-moz-range-thumb]:border-0',
|
||||
'[&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-neutral-500 [&::-moz-range-thumb]:border-0',
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
{/* Arrow pointing down */}
|
||||
<div className="w-2 h-2 bg-white dark:bg-gray-800 border-b border-r border-gray-200 dark:border-gray-700 rotate-45 -mt-[5px]" />
|
||||
<div className="w-2 h-2 bg-white dark:bg-neutral-800 border-b border-r border-neutral-200 dark:border-neutral-700 rotate-45 -mt-[5px]" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@ -274,8 +274,8 @@ export function CanvasToolbar({
|
||||
'text-[11px] font-semibold tabular-nums leading-none',
|
||||
'active:scale-90',
|
||||
playbackSpeed !== 1
|
||||
? 'text-violet-600 dark:text-violet-400 bg-violet-500/10 dark:bg-violet-400/10'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200',
|
||||
? 'text-neutral-600 dark:text-neutral-400 bg-neutral-500/10 dark:bg-neutral-400/10'
|
||||
: 'text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200',
|
||||
)}
|
||||
aria-label="Playback speed"
|
||||
>
|
||||
@ -298,7 +298,7 @@ export function CanvasToolbar({
|
||||
disabled={!canGoPrev}
|
||||
className={cn(
|
||||
ctrlBtn,
|
||||
'w-6 h-6 text-gray-500 dark:text-gray-400 disabled:opacity-20 disabled:pointer-events-none',
|
||||
'w-6 h-6 text-neutral-500 dark:text-neutral-400 disabled:opacity-20 disabled:pointer-events-none',
|
||||
)}
|
||||
aria-label="Previous scene"
|
||||
>
|
||||
@ -331,12 +331,12 @@ export function CanvasToolbar({
|
||||
e.stopPropagation();
|
||||
onContinueDiscussion();
|
||||
}}
|
||||
className="flex items-center gap-1.5 h-6 px-2.5 rounded-md border border-purple-200 dark:border-purple-700 bg-white/70 dark:bg-gray-800/70 text-purple-600 dark:text-purple-300 text-[11px] font-semibold whitespace-nowrap hover:bg-purple-50 dark:hover:bg-purple-900/20 active:scale-95 transition-all cursor-pointer"
|
||||
className="flex items-center gap-1.5 h-6 px-2.5 rounded-md border border-neutral-200 dark:border-neutral-700 bg-white/70 dark:bg-neutral-800/70 text-neutral-600 dark:text-neutral-300 text-[11px] font-semibold whitespace-nowrap hover:bg-neutral-50 dark:hover:bg-neutral-900/20 active:scale-95 transition-all cursor-pointer"
|
||||
title={t('roundtable.softClosing')}
|
||||
>
|
||||
{t('roundtable.softClosing')}
|
||||
{remainingSoftCloseSeconds !== undefined && (
|
||||
<span className="text-[9px] font-medium tabular-nums text-gray-400 dark:text-gray-500">
|
||||
<span className="text-[9px] font-medium tabular-nums text-neutral-400 dark:text-neutral-500">
|
||||
{remainingSoftCloseSeconds}s
|
||||
</span>
|
||||
)}
|
||||
@ -350,8 +350,8 @@ export function CanvasToolbar({
|
||||
ctrlBtn,
|
||||
'w-7 h-6',
|
||||
engineState === 'playing'
|
||||
? 'text-violet-600 dark:text-violet-400'
|
||||
: 'text-gray-500 dark:text-gray-400',
|
||||
? 'text-neutral-600 dark:text-neutral-400'
|
||||
: 'text-neutral-500 dark:text-neutral-400',
|
||||
)}
|
||||
aria-label={engineState === 'playing' ? 'Pause' : 'Play'}
|
||||
>
|
||||
@ -370,7 +370,7 @@ export function CanvasToolbar({
|
||||
disabled={!canGoNext}
|
||||
className={cn(
|
||||
ctrlBtn,
|
||||
'w-6 h-6 text-gray-500 dark:text-gray-400 disabled:opacity-20 disabled:pointer-events-none',
|
||||
'w-6 h-6 text-neutral-500 dark:text-neutral-400 disabled:opacity-20 disabled:pointer-events-none',
|
||||
)}
|
||||
aria-label="Next scene"
|
||||
>
|
||||
@ -391,8 +391,8 @@ export function CanvasToolbar({
|
||||
ctrlBtn,
|
||||
'w-8 h-6',
|
||||
autoPlayLecture
|
||||
? 'text-violet-600 dark:text-violet-400'
|
||||
: 'text-gray-500 dark:text-gray-400',
|
||||
? 'text-neutral-600 dark:text-neutral-400'
|
||||
: 'text-neutral-500 dark:text-neutral-400',
|
||||
)}
|
||||
aria-label="Auto-play"
|
||||
>
|
||||
@ -416,14 +416,14 @@ export function CanvasToolbar({
|
||||
ctrlBtn,
|
||||
'w-6 h-6',
|
||||
whiteboardOpen
|
||||
? 'text-violet-600 dark:text-violet-400'
|
||||
: 'text-gray-500 dark:text-gray-400',
|
||||
? 'text-neutral-600 dark:text-neutral-400'
|
||||
: 'text-neutral-500 dark:text-neutral-400',
|
||||
)}
|
||||
title={whiteboardOpen ? t('whiteboard.minimize') : t('whiteboard.open')}
|
||||
>
|
||||
<PencilLine className="w-3.5 h-3.5" />
|
||||
{!whiteboardOpen && whiteboardElementCount > 0 && (
|
||||
<span className="absolute top-0.5 right-0.5 w-1.5 h-1.5 bg-violet-500 dark:bg-violet-400 rounded-full" />
|
||||
<span className="absolute top-0.5 right-0.5 w-1.5 h-1.5 bg-neutral-500 dark:bg-neutral-400 rounded-full" />
|
||||
)}
|
||||
</button>
|
||||
|
||||
@ -438,8 +438,8 @@ export function CanvasToolbar({
|
||||
className={cn(
|
||||
'relative flex h-6 items-center gap-1 rounded-md px-2 text-[11px] font-medium transition-all',
|
||||
elementPickActive
|
||||
? 'bg-violet-500/15 text-violet-700 ring-1 ring-violet-400/40 dark:text-violet-300'
|
||||
: 'text-gray-500 hover:bg-gray-500/[0.08] dark:text-gray-400',
|
||||
? 'bg-neutral-500/15 text-neutral-700 ring-1 ring-neutral-400/40 dark:text-neutral-300'
|
||||
: 'text-neutral-500 hover:bg-neutral-500/[0.08] dark:text-neutral-400',
|
||||
!canPickSlideElement && 'cursor-not-allowed opacity-35',
|
||||
)}
|
||||
aria-label={t('chat.elementReference.button')}
|
||||
@ -467,8 +467,8 @@ export function CanvasToolbar({
|
||||
ctrlBtn,
|
||||
'w-6 h-6',
|
||||
isPresenting
|
||||
? 'text-violet-600 dark:text-violet-400'
|
||||
: 'text-gray-500 dark:text-gray-400',
|
||||
? 'text-neutral-600 dark:text-neutral-400'
|
||||
: 'text-neutral-500 dark:text-neutral-400',
|
||||
)}
|
||||
aria-label={presentationLabel}
|
||||
title={presentationLabel}
|
||||
@ -487,8 +487,8 @@ export function CanvasToolbar({
|
||||
ctrlBtn,
|
||||
'w-6 h-6',
|
||||
chatCollapsed
|
||||
? 'text-gray-400 dark:text-gray-500'
|
||||
: 'text-gray-600 dark:text-gray-300',
|
||||
? 'text-neutral-400 dark:text-neutral-500'
|
||||
: 'text-neutral-600 dark:text-neutral-300',
|
||||
)}
|
||||
aria-label="Toggle chat"
|
||||
>
|
||||
|
||||
@ -29,6 +29,8 @@ import { SessionList } from './session-list';
|
||||
import { LectureNotesView } from './lecture-notes-view';
|
||||
|
||||
interface ChatAreaProps {
|
||||
interaction?: React.ReactNode;
|
||||
onOpenWhiteboard?: () => void;
|
||||
className?: string;
|
||||
width?: number;
|
||||
onWidthChange?: (width: number) => void;
|
||||
@ -88,6 +90,8 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
(
|
||||
{
|
||||
className,
|
||||
interaction,
|
||||
onOpenWhiteboard,
|
||||
width = DEFAULT_WIDTH,
|
||||
onWidthChange,
|
||||
collapsed = false,
|
||||
@ -148,7 +152,7 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
shouldHoldAfterReveal,
|
||||
});
|
||||
|
||||
const [activeTab, setActiveTab] = useState<'lecture' | 'chat'>('lecture');
|
||||
const [activeTab, setActiveTab] = useState<'lecture' | 'chat'>('chat');
|
||||
const isDraggingRef = useRef(false);
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
const bottomRef = useRef<HTMLDivElement>(null);
|
||||
@ -268,10 +272,11 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
<div
|
||||
style={{
|
||||
width: displayWidth,
|
||||
maxWidth: '100vw',
|
||||
transition: isDragging ? 'none' : 'width 0.3s ease',
|
||||
}}
|
||||
className={cn(
|
||||
'bg-white/80 dark:bg-gray-900/80 backdrop-blur-xl border-l border-gray-100 dark:border-gray-800 shadow-[-2px_0_24px_rgba(0,0,0,0.02)] flex flex-col shrink-0 z-20 relative overflow-visible',
|
||||
'bg-background border-l border-border flex flex-col shrink-0 z-20 relative overflow-visible',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
@ -279,9 +284,9 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
{!collapsed && (
|
||||
<div
|
||||
onMouseDown={handleDragStart}
|
||||
className="absolute left-0 top-0 bottom-0 w-1.5 cursor-col-resize z-50 group hover:bg-purple-400/30 dark:hover:bg-purple-600/30 active:bg-purple-500/40 dark:active:bg-purple-500/40 transition-colors"
|
||||
className="absolute left-0 top-0 bottom-0 w-1.5 cursor-col-resize z-50 group hover:bg-neutral-400/30 dark:hover:bg-neutral-600/30 active:bg-neutral-500/40 dark:active:bg-neutral-500/40 transition-colors"
|
||||
>
|
||||
<div className="absolute left-0.5 top-1/2 -translate-y-1/2 w-0.5 h-8 rounded-full bg-gray-300 dark:bg-gray-600 group-hover:bg-purple-400 dark:group-hover:bg-purple-500 transition-colors" />
|
||||
<div className="absolute left-0.5 top-1/2 -translate-y-1/2 w-0.5 h-8 rounded-full bg-neutral-300 dark:bg-neutral-600 group-hover:bg-neutral-400 dark:group-hover:bg-neutral-500 transition-colors" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@ -289,7 +294,7 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
<Tabs
|
||||
value={activeTab}
|
||||
onValueChange={(v) => setActiveTab(v as 'lecture' | 'chat')}
|
||||
className="flex flex-col h-full gap-0"
|
||||
className="flex flex-col flex-1 min-h-0 gap-0"
|
||||
>
|
||||
{/* Tab header row */}
|
||||
<div className="h-10 flex items-center gap-1 shrink-0 mt-3 mb-1 px-3">
|
||||
@ -311,10 +316,19 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
{onOpenWhiteboard && (
|
||||
<button
|
||||
onClick={onOpenWhiteboard}
|
||||
className="shrink-0 rounded-md border border-border px-2 py-1.5 text-xs hover:bg-muted"
|
||||
>
|
||||
查看白板
|
||||
</button>
|
||||
)}
|
||||
{onCollapseChange && (
|
||||
<button
|
||||
aria-label="收起课堂互动"
|
||||
onClick={() => onCollapseChange(true)}
|
||||
className="w-7 h-7 shrink-0 rounded-lg flex items-center justify-center bg-gray-100/80 dark:bg-gray-800/80 text-gray-500 dark:text-gray-400 ring-1 ring-black/[0.04] dark:ring-white/[0.06] hover:bg-gray-200/90 dark:hover:bg-gray-700/90 hover:text-gray-700 dark:hover:text-gray-200 active:scale-90 transition-all duration-200"
|
||||
className="w-7 h-7 shrink-0 rounded-lg flex items-center justify-center bg-neutral-100/80 dark:bg-neutral-800/80 text-neutral-500 dark:text-neutral-400 ring-1 ring-black/[0.04] dark:ring-white/[0.06] hover:bg-neutral-200/90 dark:hover:bg-neutral-700/90 hover:text-neutral-700 dark:hover:text-neutral-200 active:scale-90 transition-all duration-200"
|
||||
>
|
||||
<PanelRightClose className="w-4 h-4" />
|
||||
</button>
|
||||
@ -322,7 +336,7 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
</div>
|
||||
|
||||
{/* Notes Tab */}
|
||||
<TabsContent value="lecture" className="flex-1 overflow-hidden flex flex-col">
|
||||
<TabsContent value="lecture" className="flex-1 min-h-0 overflow-hidden flex flex-col">
|
||||
<LectureNotesView
|
||||
notes={lectureNotes}
|
||||
currentSceneId={currentSceneId}
|
||||
@ -333,17 +347,17 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
</TabsContent>
|
||||
|
||||
{/* Chat Tab */}
|
||||
<TabsContent value="chat" className="flex-1 overflow-hidden flex flex-col">
|
||||
<TabsContent value="chat" className="flex-1 min-h-0 overflow-hidden flex flex-col">
|
||||
<div className="flex-1 overflow-y-auto overflow-x-hidden p-3 space-y-2 scrollbar-hide">
|
||||
{chatSessions.length === 0 ? (
|
||||
<div className="h-full flex flex-col items-center justify-center text-center p-6 opacity-50">
|
||||
<div className="w-12 h-12 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center mb-3 text-gray-300 dark:text-gray-600">
|
||||
<div className="w-12 h-12 bg-neutral-100 dark:bg-neutral-800 rounded-full flex items-center justify-center mb-3 text-neutral-300 dark:text-neutral-600">
|
||||
<MessageSquare className="w-6 h-6" />
|
||||
</div>
|
||||
<p className="text-xs font-medium text-gray-500 dark:text-gray-400">
|
||||
<p className="text-xs font-medium text-neutral-500 dark:text-neutral-400">
|
||||
{t('chat.noConversations')}
|
||||
</p>
|
||||
<p className="text-[10px] text-gray-400 dark:text-gray-500 mt-1">
|
||||
<p className="text-[10px] text-neutral-400 dark:text-neutral-500 mt-1">
|
||||
{t('chat.startConversation')}
|
||||
</p>
|
||||
</div>
|
||||
@ -364,6 +378,7 @@ export const ChatArea = forwardRef<ChatAreaRef, ChatAreaProps>(
|
||||
</div>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
{interaction && <div className="shrink-0 border-t border-border">{interaction}</div>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -74,7 +74,7 @@ const MessageBubble = memo(function MessageBubble({
|
||||
className={cn(
|
||||
'w-1.5 h-1.5 rounded-full animate-pulse',
|
||||
isTeacher
|
||||
? 'bg-purple-400/70 dark:bg-purple-500/70'
|
||||
? 'bg-neutral-400/70 dark:bg-neutral-500/70'
|
||||
: 'bg-indigo-400/70 dark:bg-indigo-500/70',
|
||||
)}
|
||||
/>
|
||||
@ -82,7 +82,7 @@ const MessageBubble = memo(function MessageBubble({
|
||||
className={cn(
|
||||
'w-1.5 h-1.5 rounded-full animate-pulse',
|
||||
isTeacher
|
||||
? 'bg-purple-400/70 dark:bg-purple-500/70'
|
||||
? 'bg-neutral-400/70 dark:bg-neutral-500/70'
|
||||
: 'bg-indigo-400/70 dark:bg-indigo-500/70',
|
||||
)}
|
||||
style={{ animationDelay: '200ms' }}
|
||||
@ -91,7 +91,7 @@ const MessageBubble = memo(function MessageBubble({
|
||||
className={cn(
|
||||
'w-1.5 h-1.5 rounded-full animate-pulse',
|
||||
isTeacher
|
||||
? 'bg-purple-400/70 dark:bg-purple-500/70'
|
||||
? 'bg-neutral-400/70 dark:bg-neutral-500/70'
|
||||
: 'bg-indigo-400/70 dark:bg-indigo-500/70',
|
||||
)}
|
||||
style={{ animationDelay: '400ms' }}
|
||||
@ -112,9 +112,9 @@ const MessageBubble = memo(function MessageBubble({
|
||||
className={cn(
|
||||
'inline-block px-2.5 py-1.5 rounded-xl text-[12px] leading-relaxed max-w-full text-left transition-shadow duration-300',
|
||||
isUser
|
||||
? 'bg-gradient-to-br from-purple-600 to-purple-700 dark:from-purple-500 dark:to-purple-600 text-white rounded-tr-sm shadow-sm shadow-purple-300/30 dark:shadow-purple-900/50 ring-1 ring-purple-500/20'
|
||||
? 'bg-gradient-to-br from-neutral-600 to-neutral-700 dark:from-neutral-500 dark:to-neutral-600 text-white rounded-tr-sm shadow-sm shadow-neutral-300/30 dark:shadow-neutral-900/50 ring-1 ring-neutral-500/20'
|
||||
: isTeacher
|
||||
? 'bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 border border-gray-100 dark:border-gray-700 rounded-tl-sm shadow-sm'
|
||||
? 'bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 border border-neutral-100 dark:border-neutral-700 rounded-tl-sm shadow-sm'
|
||||
: 'bg-indigo-50 dark:bg-indigo-900/20 text-indigo-900 dark:text-indigo-200 border border-indigo-100/50 dark:border-indigo-800/50 rounded-tl-sm',
|
||||
)}
|
||||
>
|
||||
@ -220,7 +220,7 @@ export function ChatSessionComponent({
|
||||
if (session.messages.length === 0 && !isActive) {
|
||||
return (
|
||||
<div className="h-20 flex items-center justify-center text-center px-2">
|
||||
<p className="text-[10px] text-gray-400 dark:text-gray-500">{t('chat.noMessages')}</p>
|
||||
<p className="text-[10px] text-neutral-400 dark:text-neutral-500">{t('chat.noMessages')}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -283,11 +283,11 @@ export function ChatSessionComponent({
|
||||
'flex gap-2 px-1.5 py-1 rounded-lg border-l-[3px] border-l-transparent transition-[background-color,border-color] duration-300',
|
||||
isUser && 'flex-row-reverse',
|
||||
isActiveBubble &&
|
||||
'border-l-violet-500 dark:border-l-violet-400 bg-violet-50/50 dark:bg-violet-900/20',
|
||||
'border-l-neutral-500 dark:border-l-neutral-400 bg-neutral-50/50 dark:bg-neutral-900/20',
|
||||
)}
|
||||
>
|
||||
{/* Mini Avatar */}
|
||||
<div className="w-5 h-5 rounded-full overflow-hidden bg-gray-100 dark:bg-gray-800 shrink-0 mt-0.5 ring-1 ring-gray-200/50 dark:ring-gray-700/50">
|
||||
<div className="w-5 h-5 rounded-full overflow-hidden bg-neutral-100 dark:bg-neutral-800 shrink-0 mt-0.5 ring-1 ring-neutral-200/50 dark:ring-neutral-700/50">
|
||||
<AvatarDisplay src={avatar} alt="avatar" className="text-xs" />
|
||||
</div>
|
||||
|
||||
@ -297,9 +297,9 @@ export function ChatSessionComponent({
|
||||
className={cn(
|
||||
'text-[9px] font-bold uppercase tracking-wider block mb-0.5',
|
||||
isUser
|
||||
? 'text-purple-500 dark:text-purple-400'
|
||||
? 'text-neutral-500 dark:text-neutral-400'
|
||||
: isTeacher
|
||||
? 'text-purple-400 dark:text-purple-300'
|
||||
? 'text-neutral-400 dark:text-neutral-300'
|
||||
: 'text-indigo-400 dark:text-indigo-300',
|
||||
)}
|
||||
>
|
||||
@ -336,12 +336,12 @@ export function ChatSessionComponent({
|
||||
transition={{ duration: 0.4, ease: [0.16, 1, 0.3, 1] }}
|
||||
className="mx-3 mt-2 mb-1 flex items-center gap-2"
|
||||
>
|
||||
<div className="flex-1 h-px bg-gradient-to-r from-transparent via-gray-200 dark:via-gray-700 to-transparent" />
|
||||
<span className="flex items-center gap-1 text-[9px] text-gray-400 dark:text-gray-500 font-medium">
|
||||
<div className="flex-1 h-px bg-gradient-to-r from-transparent via-neutral-200 dark:via-neutral-700 to-transparent" />
|
||||
<span className="flex items-center gap-1 text-[9px] text-neutral-400 dark:text-neutral-500 font-medium">
|
||||
<CircleStop className="w-2.5 h-2.5" />
|
||||
{t('chat.ended')}
|
||||
</span>
|
||||
<div className="flex-1 h-px bg-gradient-to-r from-transparent via-gray-200 dark:via-gray-700 to-transparent" />
|
||||
<div className="flex-1 h-px bg-gradient-to-r from-transparent via-neutral-200 dark:via-neutral-700 to-transparent" />
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
@ -368,12 +368,12 @@ export function ChatSessionComponent({
|
||||
{isSoftClosing && onContinueSession && (
|
||||
<button
|
||||
onClick={() => onContinueSession(session.id)}
|
||||
className="h-7 bg-white dark:bg-gray-800 text-purple-600 dark:text-purple-300 border border-purple-200 dark:border-purple-700 px-2.5 rounded-md text-[11px] font-semibold flex items-center gap-1.5 transition-colors hover:bg-purple-50 dark:hover:bg-purple-900/25"
|
||||
className="h-7 bg-white dark:bg-neutral-800 text-neutral-600 dark:text-neutral-300 border border-neutral-200 dark:border-neutral-700 px-2.5 rounded-md text-[11px] font-semibold flex items-center gap-1.5 transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-900/25"
|
||||
>
|
||||
<MessageCircleMore className="size-3" />
|
||||
{t('chat.softClosing')}
|
||||
{remainingSoftCloseSeconds !== undefined && (
|
||||
<span className="text-[9px] font-medium tabular-nums text-gray-400 dark:text-gray-500">
|
||||
<span className="text-[9px] font-medium tabular-nums text-neutral-400 dark:text-neutral-500">
|
||||
{remainingSoftCloseSeconds}s
|
||||
</span>
|
||||
)}
|
||||
|
||||
@ -32,8 +32,8 @@ interface InlineActionTagProps {
|
||||
// ── Style tokens ──────────────────────────────────────────────
|
||||
|
||||
const WB_STYLE =
|
||||
'bg-violet-50 dark:bg-violet-500/15 border-violet-300/40 dark:border-violet-500/30 text-violet-600 dark:text-violet-300';
|
||||
const WB_ACCENT = 'bg-violet-500 dark:bg-violet-400';
|
||||
'bg-neutral-50 dark:bg-neutral-500/15 border-neutral-300/40 dark:border-neutral-500/30 text-neutral-600 dark:text-neutral-300';
|
||||
const WB_ACCENT = 'bg-neutral-500 dark:bg-neutral-400';
|
||||
|
||||
const SPOTLIGHT_STYLE =
|
||||
'bg-yellow-50 dark:bg-yellow-500/15 border-yellow-300/40 dark:border-yellow-500/30 text-yellow-700 dark:text-yellow-300';
|
||||
@ -42,7 +42,7 @@ const LASER_STYLE =
|
||||
const DISCUSS_STYLE =
|
||||
'bg-amber-50 dark:bg-amber-500/15 border-amber-300/40 dark:border-amber-500/30 text-amber-700 dark:text-amber-300';
|
||||
const DEFAULT_STYLE =
|
||||
'bg-gray-50 dark:bg-gray-500/15 border-gray-300/40 dark:border-gray-500/30 text-gray-600 dark:text-gray-300';
|
||||
'bg-neutral-50 dark:bg-neutral-500/15 border-neutral-300/40 dark:border-neutral-500/30 text-neutral-600 dark:text-neutral-300';
|
||||
|
||||
// ── Action config ─────────────────────────────────────────────
|
||||
|
||||
@ -110,7 +110,7 @@ export function InlineActionTag({ actionName, state }: InlineActionTagProps) {
|
||||
WB_ACCENT,
|
||||
)}
|
||||
>
|
||||
<PenLine className="w-[7px] h-[7px] text-white dark:text-violet-950" strokeWidth={2.5} />
|
||||
<PenLine className="w-[7px] h-[7px] text-white dark:text-neutral-950" strokeWidth={2.5} />
|
||||
</span>
|
||||
)}
|
||||
|
||||
|
||||
@ -85,13 +85,13 @@ export function LectureNotesView({
|
||||
if (notes.length === 0) {
|
||||
return (
|
||||
<div className="h-full flex flex-col items-center justify-center text-center p-6">
|
||||
<div className="w-12 h-12 bg-purple-50 dark:bg-purple-900/20 rounded-2xl flex items-center justify-center mb-3 text-purple-300 dark:text-purple-600 ring-1 ring-purple-100 dark:ring-purple-800/30">
|
||||
<div className="w-12 h-12 bg-neutral-50 dark:bg-neutral-900/20 rounded-2xl flex items-center justify-center mb-3 text-neutral-300 dark:text-neutral-600 ring-1 ring-neutral-100 dark:ring-neutral-800/30">
|
||||
<BookOpen className="w-6 h-6" />
|
||||
</div>
|
||||
<p className="text-xs font-medium text-gray-500 dark:text-gray-400">
|
||||
<p className="text-xs font-medium text-neutral-500 dark:text-neutral-400">
|
||||
{t('chat.lectureNotes.empty')}
|
||||
</p>
|
||||
<p className="text-[10px] text-gray-400 dark:text-gray-500 mt-1">
|
||||
<p className="text-[10px] text-neutral-400 dark:text-neutral-500 mt-1">
|
||||
{t('chat.lectureNotes.emptyHint')}
|
||||
</p>
|
||||
</div>
|
||||
@ -115,8 +115,8 @@ export function LectureNotesView({
|
||||
className={cn(
|
||||
'relative mb-3 last:mb-0 rounded-lg px-3 py-2.5 transition-colors duration-200',
|
||||
isCurrent
|
||||
? 'bg-purple-50/80 dark:bg-purple-950/25 ring-1 ring-purple-200/60 dark:ring-purple-700/30'
|
||||
: 'bg-gray-50/50 dark:bg-gray-800/30',
|
||||
? 'bg-neutral-50/80 dark:bg-neutral-950/25 ring-1 ring-neutral-200/60 dark:ring-neutral-700/30'
|
||||
: 'bg-neutral-50/50 dark:bg-neutral-800/30',
|
||||
)}
|
||||
>
|
||||
{/* Page label row */}
|
||||
@ -126,29 +126,29 @@ export function LectureNotesView({
|
||||
className={cn(
|
||||
'w-2 h-2 rounded-full shrink-0',
|
||||
isCurrent
|
||||
? 'bg-purple-500 dark:bg-purple-400 shadow-sm shadow-purple-400/40'
|
||||
: 'bg-gray-300 dark:bg-gray-600',
|
||||
? 'bg-neutral-500 dark:bg-neutral-400 shadow-sm shadow-neutral-400/40'
|
||||
: 'bg-neutral-300 dark:bg-neutral-600',
|
||||
)}
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
'text-[10px] font-semibold tracking-wide',
|
||||
isCurrent
|
||||
? 'text-purple-600 dark:text-purple-400'
|
||||
: 'text-gray-400 dark:text-gray-500',
|
||||
? 'text-neutral-600 dark:text-neutral-400'
|
||||
: 'text-neutral-400 dark:text-neutral-500',
|
||||
)}
|
||||
>
|
||||
{pageLabel}
|
||||
</span>
|
||||
{isCurrent && (
|
||||
<span className="text-[9px] font-bold px-1.5 py-px rounded-full bg-purple-100 dark:bg-purple-900/40 text-purple-600 dark:text-purple-300">
|
||||
<span className="text-[9px] font-bold px-1.5 py-px rounded-full bg-neutral-100 dark:bg-neutral-900/40 text-neutral-600 dark:text-neutral-300">
|
||||
{t('chat.lectureNotes.currentPage')}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Scene title */}
|
||||
<h4 className="text-[13px] font-bold text-gray-800 dark:text-gray-100 mb-1.5 leading-snug pl-4">
|
||||
<h4 className="text-[13px] font-bold text-neutral-800 dark:text-neutral-100 mb-1.5 leading-snug pl-4">
|
||||
{note.sceneTitle}
|
||||
</h4>
|
||||
|
||||
@ -259,10 +259,10 @@ export function LectureNotesView({
|
||||
className={cn(
|
||||
'block w-full text-left rounded-md px-1 py-0.5 text-[12px] leading-[1.8] transition-colors',
|
||||
isActiveSpeech
|
||||
? 'bg-purple-100/80 text-purple-800 dark:bg-purple-900/35 dark:text-purple-200'
|
||||
: 'text-gray-700 dark:text-gray-300',
|
||||
? 'bg-neutral-100/80 text-neutral-800 dark:bg-neutral-900/35 dark:text-neutral-200'
|
||||
: 'text-neutral-700 dark:text-neutral-300',
|
||||
canJump
|
||||
? 'cursor-pointer hover:bg-purple-50 dark:hover:bg-purple-950/25'
|
||||
? 'cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-950/25'
|
||||
: 'cursor-default',
|
||||
)}
|
||||
aria-label={jumpTitle}
|
||||
@ -274,7 +274,7 @@ export function LectureNotesView({
|
||||
return (
|
||||
<p
|
||||
key={i}
|
||||
className="text-[12px] leading-[1.8] text-gray-700 dark:text-gray-300"
|
||||
className="text-[12px] leading-[1.8] text-neutral-700 dark:text-neutral-300"
|
||||
>
|
||||
{content}
|
||||
</p>
|
||||
|
||||
@ -141,7 +141,7 @@ export const ProactiveCard = ({
|
||||
e.stopPropagation();
|
||||
onSkip();
|
||||
}}
|
||||
className="absolute -top-2 -right-2 w-6 h-6 bg-white dark:bg-gray-800 shadow-md border border-gray-100 dark:border-gray-700 rounded-full flex items-center justify-center text-gray-400 hover:text-red-500 hover:scale-110 transition-all z-20 group/close"
|
||||
className="absolute -top-2 -right-2 w-6 h-6 bg-white dark:bg-neutral-800 shadow-md border border-neutral-100 dark:border-neutral-700 rounded-full flex items-center justify-center text-neutral-400 hover:text-red-500 hover:scale-110 transition-all z-20 group/close"
|
||||
title={t('proactiveCard.skip')}
|
||||
>
|
||||
<X className="w-3 h-3 stroke-[2.5]" />
|
||||
@ -149,7 +149,7 @@ export const ProactiveCard = ({
|
||||
|
||||
{/* Triangle Tail */}
|
||||
<div
|
||||
className="absolute -bottom-[6px] w-3 h-3 bg-white dark:bg-gray-800 border-b border-r border-gray-100 dark:border-gray-700 z-10"
|
||||
className="absolute -bottom-[6px] w-3 h-3 bg-white dark:bg-neutral-800 border-b border-r border-neutral-100 dark:border-neutral-700 z-10"
|
||||
style={{
|
||||
left: `${pos.tailOffset}px`,
|
||||
transform: 'translateX(-50%) rotate(45deg)',
|
||||
@ -157,13 +157,13 @@ export const ProactiveCard = ({
|
||||
/>
|
||||
|
||||
{/* Card body */}
|
||||
<div className="bg-white/95 dark:bg-gray-800/95 backdrop-blur-sm p-3.5 rounded-2xl shadow-[0_8px_32px_rgba(0,0,0,0.12)] border border-gray-100 dark:border-gray-700 flex flex-col gap-2.5 relative overflow-hidden">
|
||||
<div className="bg-white/95 dark:bg-neutral-800/95 backdrop-blur-sm p-3.5 rounded-2xl shadow-[0_8px_32px_rgba(0,0,0,0.12)] border border-neutral-100 dark:border-neutral-700 flex flex-col gap-2.5 relative overflow-hidden">
|
||||
{/* Progress Bar */}
|
||||
<div className="absolute top-0 left-0 right-0 h-1 bg-gray-50/50 dark:bg-gray-700/50">
|
||||
<div className="absolute top-0 left-0 right-0 h-1 bg-neutral-50/50 dark:bg-neutral-700/50">
|
||||
<div
|
||||
className={`h-full transition-all duration-[50ms] ease-linear ${
|
||||
isPaused
|
||||
? 'bg-gray-300 dark:bg-gray-600'
|
||||
? 'bg-neutral-300 dark:bg-neutral-600'
|
||||
: 'bg-gradient-to-r from-amber-400 to-amber-500 dark:from-amber-500 dark:to-amber-600'
|
||||
}`}
|
||||
style={{ width: `${progress}%` }}
|
||||
@ -173,7 +173,7 @@ export const ProactiveCard = ({
|
||||
{/* Header */}
|
||||
<div className="flex items-center gap-2 px-0.5 pt-1">
|
||||
{agentAvatar && (
|
||||
<div className="w-6 h-6 rounded-full overflow-hidden shrink-0 border border-gray-100 dark:border-gray-700">
|
||||
<div className="w-6 h-6 rounded-full overflow-hidden shrink-0 border border-neutral-100 dark:border-neutral-700">
|
||||
<img
|
||||
src={agentAvatar}
|
||||
alt={agentName || ''}
|
||||
@ -183,7 +183,7 @@ export const ProactiveCard = ({
|
||||
)}
|
||||
<div className="flex items-center gap-1.5 flex-1 min-w-0">
|
||||
{agentName && (
|
||||
<span className="text-[11px] font-semibold text-gray-700 dark:text-gray-300 truncate">
|
||||
<span className="text-[11px] font-semibold text-neutral-700 dark:text-neutral-300 truncate">
|
||||
{agentName}
|
||||
</span>
|
||||
)}
|
||||
@ -199,14 +199,16 @@ export const ProactiveCard = ({
|
||||
</div>
|
||||
<span
|
||||
className={`text-[10px] font-bold tabular-nums shrink-0 ${
|
||||
isPaused ? 'text-gray-300 dark:text-gray-600' : 'text-gray-400 dark:text-gray-500'
|
||||
isPaused
|
||||
? 'text-neutral-300 dark:text-neutral-600'
|
||||
: 'text-neutral-400 dark:text-neutral-500'
|
||||
}`}
|
||||
>
|
||||
{Math.max(0, Math.ceil((progress / 100) * (DISCUSSION_AUTO_SKIP_MS / 1000)))}s
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p className="text-[13px] font-bold text-gray-800 dark:text-gray-200 leading-snug px-0.5">
|
||||
<p className="text-[13px] font-bold text-neutral-800 dark:text-neutral-200 leading-snug px-0.5">
|
||||
{action.topic}
|
||||
</p>
|
||||
|
||||
@ -229,7 +231,7 @@ export const ProactiveCard = ({
|
||||
className={`p-2 aspect-square rounded-lg border transition-colors active:scale-90 ${
|
||||
isPaused
|
||||
? 'bg-amber-50 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-700 hover:bg-amber-100 dark:hover:bg-amber-900/50'
|
||||
: 'bg-gray-50 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 border-gray-100 dark:border-gray-600'
|
||||
: 'bg-neutral-50 hover:bg-neutral-100 dark:bg-neutral-700 dark:hover:bg-neutral-600 text-neutral-400 hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-300 border-neutral-100 dark:border-neutral-600'
|
||||
}`}
|
||||
title={isPaused ? t('proactiveCard.resume') : t('proactiveCard.pause')}
|
||||
>
|
||||
|
||||
@ -20,7 +20,7 @@ interface SessionListProps {
|
||||
const sessionBadgeStyles = {
|
||||
qa: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300',
|
||||
discussion: 'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300',
|
||||
lecture: 'bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300',
|
||||
lecture: 'bg-neutral-100 text-neutral-700 dark:bg-neutral-900/30 dark:text-neutral-300',
|
||||
};
|
||||
|
||||
// Labels are provided via i18n in the component
|
||||
@ -34,12 +34,12 @@ function getStatusIcon(status: SessionStatus) {
|
||||
case 'interrupted':
|
||||
return <Clock className="size-2.5 text-yellow-500" />;
|
||||
case 'completed':
|
||||
return <CheckCircle className="size-2.5 text-gray-400" />;
|
||||
return <CheckCircle className="size-2.5 text-neutral-400" />;
|
||||
case 'error':
|
||||
return <AlertCircle className="size-2.5 text-red-500" />;
|
||||
case 'idle':
|
||||
default:
|
||||
return <Circle className="size-2.5 text-gray-300" />;
|
||||
return <Circle className="size-2.5 text-neutral-300" />;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ export function SessionList({
|
||||
const isActive = session.status === 'active' || session.status === 'soft-closing';
|
||||
const dotColor =
|
||||
session.type === 'lecture'
|
||||
? 'bg-purple-500'
|
||||
? 'bg-neutral-500'
|
||||
: session.type === 'qa'
|
||||
? 'bg-blue-500'
|
||||
: 'bg-amber-500';
|
||||
@ -71,14 +71,14 @@ export function SessionList({
|
||||
className={cn(
|
||||
'rounded-xl border transition-all duration-500 overflow-hidden',
|
||||
isActive
|
||||
? 'border-purple-200 dark:border-purple-700 bg-purple-50/30 dark:bg-purple-900/20 shadow-sm'
|
||||
: 'border-gray-100 dark:border-gray-800 bg-white/50 dark:bg-gray-800/50',
|
||||
? 'border-neutral-200 dark:border-neutral-700 bg-neutral-50/30 dark:bg-neutral-900/20 shadow-sm'
|
||||
: 'border-neutral-100 dark:border-neutral-800 bg-white/50 dark:bg-neutral-800/50',
|
||||
)}
|
||||
>
|
||||
{/* Session Header */}
|
||||
<button
|
||||
onClick={() => onToggleExpand(session.id)}
|
||||
className="w-full flex items-center gap-1.5 px-3 py-2 text-left hover:bg-gray-50/50 dark:hover:bg-gray-800/50 transition-colors"
|
||||
className="w-full flex items-center gap-1.5 px-3 py-2 text-left hover:bg-neutral-50/50 dark:hover:bg-neutral-800/50 transition-colors"
|
||||
>
|
||||
<span className="relative flex h-2.5 w-2.5 shrink-0">
|
||||
<span className={cn(dotColor, 'relative inline-flex rounded-full h-2.5 w-2.5')} />
|
||||
@ -99,18 +99,18 @@ export function SessionList({
|
||||
>
|
||||
{t(`chat.badge.${session.type}`)}
|
||||
</span>
|
||||
<span className="flex-1 text-[11px] font-semibold text-gray-700 dark:text-gray-300 truncate">
|
||||
<span className="flex-1 text-[11px] font-semibold text-neutral-700 dark:text-neutral-300 truncate">
|
||||
{session.title}
|
||||
</span>
|
||||
<div className="flex items-center gap-1 text-[9px] text-gray-400 dark:text-gray-500">
|
||||
<div className="flex items-center gap-1 text-[9px] text-neutral-400 dark:text-neutral-500">
|
||||
{getStatusIcon(session.status)}
|
||||
</div>
|
||||
<span className="text-[9px] text-gray-400 dark:text-gray-500 font-medium tabular-nums shrink-0">
|
||||
<span className="text-[9px] text-neutral-400 dark:text-neutral-500 font-medium tabular-nums shrink-0">
|
||||
{session.messages.length}
|
||||
</span>
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
'w-3.5 h-3.5 text-gray-400 dark:text-gray-500 transition-transform duration-200 shrink-0',
|
||||
'w-3.5 h-3.5 text-neutral-400 dark:text-neutral-500 transition-transform duration-200 shrink-0',
|
||||
!isExpanded && '-rotate-90',
|
||||
)}
|
||||
/>
|
||||
@ -124,7 +124,7 @@ export function SessionList({
|
||||
animate={{ height: 'auto', opacity: 1 }}
|
||||
exit={{ height: 0, opacity: 0 }}
|
||||
transition={{ duration: 0.2, ease: 'easeInOut' }}
|
||||
className="overflow-hidden border-t border-gray-100/50 dark:border-gray-700/50"
|
||||
className="overflow-hidden border-t border-neutral-100/50 dark:border-neutral-700/50"
|
||||
>
|
||||
<div className="px-2 pb-2 pt-1">
|
||||
<ChatSessionComponent
|
||||
|
||||
@ -331,7 +331,7 @@ export function ClassroomSurface({
|
||||
}
|
||||
>
|
||||
{loading || (variant === 'pane' && !error && loadedClassroomId !== classroomId) ? (
|
||||
<div className="flex-1 flex items-center justify-center bg-gray-50 dark:bg-gray-900">
|
||||
<div className="flex-1 flex items-center justify-center bg-neutral-50 dark:bg-neutral-900">
|
||||
<div className="flex flex-col items-center gap-3 text-muted-foreground">
|
||||
<Loader2 className="h-8 w-8 animate-spin" />
|
||||
<p>{t('common.loadingClassroom')}</p>
|
||||
@ -343,7 +343,7 @@ export function ClassroomSurface({
|
||||
// the answer. One message for "deleted" and for "never existed" —
|
||||
// see the state's declaration.
|
||||
<div
|
||||
className="flex-1 flex items-center justify-center bg-gray-50 dark:bg-gray-900"
|
||||
className="flex-1 flex items-center justify-center bg-neutral-50 dark:bg-neutral-900"
|
||||
data-testid="classroom-not-found"
|
||||
>
|
||||
<div className="flex flex-col items-center gap-3 text-center max-w-md px-6">
|
||||
@ -359,7 +359,7 @@ export function ClassroomSurface({
|
||||
</div>
|
||||
</div>
|
||||
) : error ? (
|
||||
<div className="flex-1 flex items-center justify-center bg-gray-50 dark:bg-gray-900">
|
||||
<div className="flex-1 flex items-center justify-center bg-neutral-50 dark:bg-neutral-900">
|
||||
<div className="text-center">
|
||||
<p className="text-destructive mb-4">
|
||||
{t('common.errorPrefix')}
|
||||
|
||||
@ -155,10 +155,10 @@ export function FolderCard({
|
||||
<div
|
||||
ref={thumbRef}
|
||||
className={cn(
|
||||
'relative w-full aspect-[16/9] rounded-2xl bg-gradient-to-br from-violet-50 to-blue-50 dark:from-violet-900/20 dark:to-blue-900/20 overflow-hidden transition-transform duration-200 group-hover:scale-[1.02] ring-1',
|
||||
'relative w-full aspect-[16/9] rounded-2xl bg-gradient-to-br from-neutral-50 to-blue-50 dark:from-neutral-900/20 dark:to-blue-900/20 overflow-hidden transition-transform duration-200 group-hover:scale-[1.02] ring-1',
|
||||
dropActive
|
||||
? 'ring-2 ring-violet-500 ring-offset-2 ring-offset-background scale-[1.03]'
|
||||
: 'ring-violet-200/50 dark:ring-violet-800/40',
|
||||
? 'ring-2 ring-neutral-500 ring-offset-2 ring-offset-background scale-[1.03]'
|
||||
: 'ring-neutral-200/50 dark:ring-neutral-800/40',
|
||||
)}
|
||||
>
|
||||
{hasCovers ? (
|
||||
@ -166,8 +166,8 @@ export function FolderCard({
|
||||
) : courseCount === 0 ? (
|
||||
// Truly empty folder: folder icon.
|
||||
<div className="absolute inset-0 flex flex-col items-center justify-center gap-2">
|
||||
<div className="size-14 rounded-2xl bg-violet-100 dark:bg-violet-900/40 flex items-center justify-center">
|
||||
<Folder className="size-7 text-violet-500 dark:text-violet-300" />
|
||||
<div className="size-14 rounded-2xl bg-neutral-100 dark:bg-neutral-900/40 flex items-center justify-center">
|
||||
<Folder className="size-7 text-neutral-500 dark:text-neutral-300" />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
@ -175,11 +175,11 @@ export function FolderCard({
|
||||
// distinct from the empty-folder icon, so it does not read as empty.
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<div
|
||||
className="w-[60%] aspect-[16/9] rounded-xl bg-violet-200/60 dark:bg-violet-800/30 shadow-md ring-1 ring-violet-300/30 dark:ring-violet-700/30"
|
||||
className="w-[60%] aspect-[16/9] rounded-xl bg-neutral-200/60 dark:bg-neutral-800/30 shadow-md ring-1 ring-neutral-300/30 dark:ring-neutral-700/30"
|
||||
style={{ transform: 'translate(-3%, 2%)' }}
|
||||
/>
|
||||
<div
|
||||
className="absolute w-[60%] aspect-[16/9] rounded-xl bg-violet-300/50 dark:bg-violet-700/20 shadow-md ring-1 ring-violet-300/30 dark:ring-violet-700/30"
|
||||
className="absolute w-[60%] aspect-[16/9] rounded-xl bg-neutral-300/50 dark:bg-neutral-700/20 shadow-md ring-1 ring-neutral-300/30 dark:ring-neutral-700/30"
|
||||
style={{ transform: 'translate(3%, -1%)' }}
|
||||
/>
|
||||
</div>
|
||||
@ -191,7 +191,7 @@ export function FolderCard({
|
||||
</span>
|
||||
|
||||
{dropActive && (
|
||||
<div className="absolute inset-0 z-20 flex items-center justify-center bg-violet-500/20 backdrop-blur-[2px]">
|
||||
<div className="absolute inset-0 z-20 flex items-center justify-center bg-neutral-500/20 backdrop-blur-[2px]">
|
||||
<Folder className="size-8 text-white drop-shadow" />
|
||||
</div>
|
||||
)}
|
||||
@ -325,7 +325,7 @@ export function FolderCard({
|
||||
</div>
|
||||
|
||||
<div className="mt-2.5 px-1 flex items-center gap-2">
|
||||
<span className="shrink-0 inline-flex items-center rounded-full bg-violet-100 dark:bg-violet-900/30 px-2 py-0.5 text-[11px] font-medium text-violet-600 dark:text-violet-400">
|
||||
<span className="shrink-0 inline-flex items-center rounded-full bg-neutral-100 dark:bg-neutral-900/30 px-2 py-0.5 text-[11px] font-medium text-neutral-600 dark:text-neutral-400">
|
||||
{t('classroom.folderBadge')}
|
||||
</span>
|
||||
{editing ? (
|
||||
@ -344,7 +344,7 @@ export function FolderCard({
|
||||
onBlur={commit}
|
||||
disabled={submitting}
|
||||
maxLength={80}
|
||||
className="w-full bg-transparent border-b border-violet-400/60 text-[15px] font-medium text-foreground/90 outline-none disabled:opacity-50"
|
||||
className="w-full bg-transparent border-b border-neutral-400/60 text-[15px] font-medium text-foreground/90 outline-none disabled:opacity-50"
|
||||
/>
|
||||
{error && <p className="mt-1 text-[11px] text-destructive">{error}</p>}
|
||||
</div>
|
||||
@ -417,7 +417,7 @@ function CoverStack({
|
||||
}}
|
||||
>
|
||||
{thumbWidth > 0 && (
|
||||
<div className="aspect-[16/9] w-full rounded-xl overflow-hidden shadow-md ring-1 ring-black/5 bg-slate-200 dark:bg-slate-700">
|
||||
<div className="aspect-[16/9] w-full rounded-xl overflow-hidden shadow-md ring-1 ring-black/5 bg-neutral-200 dark:bg-neutral-700">
|
||||
<SlideThumbnail
|
||||
slide={cover}
|
||||
size={Math.round((thumbWidth * widthPct) / 100)}
|
||||
|
||||
@ -42,7 +42,7 @@ export function MoveToFolderMenu({
|
||||
title={t('classroom.moveToFolder')}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
className="absolute top-2 right-20 size-7 inline-flex items-center justify-center rounded-full bg-black/30 hover:bg-black/50 text-white hover:text-white backdrop-blur-sm opacity-0 transition-opacity z-10 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-400 pointer-coarse:opacity-100 group-hover:opacity-100"
|
||||
className="absolute top-2 right-20 size-7 inline-flex items-center justify-center rounded-full bg-black/30 hover:bg-black/50 text-white hover:text-white backdrop-blur-sm opacity-0 transition-opacity z-10 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400 pointer-coarse:opacity-100 group-hover:opacity-100"
|
||||
>
|
||||
<FolderInput className="size-3.5" />
|
||||
</button>
|
||||
@ -62,7 +62,7 @@ export function MoveToFolderMenu({
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span>{t('classroom.ungrouped')}</span>
|
||||
{currentFolderId === undefined && <Check className="size-3.5 text-violet-500" />}
|
||||
{currentFolderId === undefined && <Check className="size-3.5 text-neutral-500" />}
|
||||
</DropdownMenuItem>
|
||||
|
||||
{/* All folders */}
|
||||
@ -73,7 +73,7 @@ export function MoveToFolderMenu({
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span className="truncate">{f.name}</span>
|
||||
{currentFolderId === f.id && <Check className="size-3.5 text-violet-500 shrink-0" />}
|
||||
{currentFolderId === f.id && <Check className="size-3.5 text-neutral-500 shrink-0" />}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
|
||||
|
||||
@ -299,7 +299,7 @@ function Frame({
|
||||
|
||||
return (
|
||||
<StageGrid
|
||||
className="bg-gradient-to-b from-zinc-100 to-zinc-200 dark:from-zinc-950 dark:to-zinc-900"
|
||||
className="bg-gradient-to-b from-neutral-100 to-neutral-200 dark:from-neutral-950 dark:to-neutral-900"
|
||||
topSlot={
|
||||
hideCommandBar ? null : (
|
||||
// `data-maic-edit-chrome`: the workbench's hand-edit signal scope
|
||||
@ -353,7 +353,7 @@ function Frame({
|
||||
{usesClassroomAspect(sceneType) ? (
|
||||
<ContainBox
|
||||
fit="contain"
|
||||
className="overflow-hidden rounded-xl bg-white ring-1 ring-zinc-200/80 dark:bg-zinc-900 dark:ring-zinc-800/80 shadow-[0_10px_40px_-12px_rgba(15,23,42,0.18)] dark:shadow-[0_10px_40px_-12px_rgba(0,0,0,0.6)]"
|
||||
className="overflow-hidden rounded-xl bg-white ring-1 ring-neutral-200/80 dark:bg-neutral-900 dark:ring-neutral-800/80 shadow-[0_10px_40px_-12px_rgba(15,23,42,0.18)] dark:shadow-[0_10px_40px_-12px_rgba(0,0,0,0.6)]"
|
||||
>
|
||||
<div
|
||||
data-maic-edit-canvas="true"
|
||||
@ -367,7 +367,7 @@ function Frame({
|
||||
<div
|
||||
data-maic-edit-canvas="true"
|
||||
data-maic-stage-card="true"
|
||||
className="relative h-full w-full overflow-hidden rounded-xl bg-white ring-1 ring-zinc-200/80 dark:bg-zinc-900 dark:ring-zinc-800/80 shadow-[0_10px_40px_-12px_rgba(15,23,42,0.18)] dark:shadow-[0_10px_40px_-12px_rgba(0,0,0,0.6)]"
|
||||
className="relative h-full w-full overflow-hidden rounded-xl bg-white ring-1 ring-neutral-200/80 dark:bg-neutral-900 dark:ring-neutral-800/80 shadow-[0_10px_40px_-12px_rgba(15,23,42,0.18)] dark:shadow-[0_10px_40px_-12px_rgba(0,0,0,0.6)]"
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
|
||||
@ -161,8 +161,15 @@ export const PlaybackChromeRoot = forwardRef<PlaybackChromeRootHandle, PlaybackC
|
||||
const setSidebarCollapsed = useSettingsStore((s) => s.setSidebarCollapsed);
|
||||
const chatAreaWidth = useSettingsStore((s) => s.chatAreaWidth);
|
||||
const setChatAreaWidth = useSettingsStore((s) => s.setChatAreaWidth);
|
||||
const chatAreaCollapsed = useSettingsStore((s) => s.chatAreaCollapsed);
|
||||
const setChatAreaCollapsed = useSettingsStore((s) => s.setChatAreaCollapsed);
|
||||
const [playbackToolbarHost, setPlaybackToolbarHost] = useState<HTMLDivElement | null>(null);
|
||||
const [chatAreaCollapsed, setChatAreaCollapsed] = useState(false);
|
||||
useEffect(() => {
|
||||
// Mobile starts with the lesson visible; the interaction drawer opens on demand.
|
||||
if (window.innerWidth < 900) {
|
||||
setChatAreaCollapsed(true);
|
||||
setSidebarCollapsed(true);
|
||||
}
|
||||
}, [setSidebarCollapsed]);
|
||||
const setTTSMuted = useSettingsStore((s) => s.setTTSMuted);
|
||||
const setTTSVolume = useSettingsStore((s) => s.setTTSVolume);
|
||||
|
||||
@ -216,6 +223,11 @@ export const PlaybackChromeRoot = forwardRef<PlaybackChromeRootHandle, PlaybackC
|
||||
// Whiteboard state (from canvas store so AI tools can open it)
|
||||
const whiteboardOpen = useCanvasStore.use.whiteboardOpen();
|
||||
const setWhiteboardOpenManually = useCanvasStore.use.setWhiteboardOpenManually();
|
||||
useEffect(() => {
|
||||
// On narrow screens the interaction drawer covers the teaching canvas.
|
||||
// Reveal the board when an AI action (or the learner) opens it.
|
||||
if (whiteboardOpen && window.innerWidth < 900) setChatAreaCollapsed(true);
|
||||
}, [whiteboardOpen]);
|
||||
|
||||
// Selected agents from settings store (Zustand)
|
||||
const selectedAgentIds = useSettingsStore((s) => s.selectedAgentIds);
|
||||
@ -1435,21 +1447,180 @@ export const PlaybackChromeRoot = forwardRef<PlaybackChromeRootHandle, PlaybackC
|
||||
}
|
||||
: null;
|
||||
|
||||
// Scene viewer height — header is 80px when visible, roundtable is
|
||||
// 192px in playback mode (autonomous hides it). Mode is guaranteed
|
||||
// non-'edit' here since the parent Stage unmounts this component
|
||||
// when entering Pro mode.
|
||||
const sceneViewerHeight = (() => {
|
||||
const headerHeight = isPresenting || hideHeader ? 0 : 80;
|
||||
const roundtableHeight = mode === 'playback' && !isPresenting ? 192 : 0;
|
||||
return `calc(100% - ${headerHeight + roundtableHeight}px)`;
|
||||
})();
|
||||
const roundtable = (
|
||||
<Roundtable
|
||||
layout={isPresenting ? 'stage' : 'sidebar'}
|
||||
toolbarContainer={playbackToolbarHost}
|
||||
mode={mode === 'autonomous' ? 'autonomous' : 'playback'}
|
||||
initialParticipants={participants}
|
||||
playbackView={playbackView}
|
||||
currentSpeech={liveSpeech}
|
||||
lectureSpeech={lectureSpeech}
|
||||
idleText={firstSpeechText}
|
||||
playbackCompleted={playbackCompleted}
|
||||
discussionRequest={discussionRequest}
|
||||
engineMode={engineMode}
|
||||
isStreaming={chatIsStreaming}
|
||||
audioIndicatorState={audioIndicatorState}
|
||||
audioAgentId={audioAgentId}
|
||||
sessionType={
|
||||
chatSessionType === 'qa'
|
||||
? 'qa'
|
||||
: chatSessionType === 'discussion'
|
||||
? 'discussion'
|
||||
: undefined
|
||||
}
|
||||
speakingAgentId={speakingAgentId}
|
||||
speechProgress={speechProgress}
|
||||
showEndFlash={showEndFlash}
|
||||
endFlashSessionType={endFlashSessionType}
|
||||
thinkingState={thinkingState}
|
||||
isCueUser={isCueUser}
|
||||
isSoftClosing={chatIsSoftClosing}
|
||||
softCloseDeadline={softCloseDeadline}
|
||||
isTopicPending={isTopicPending}
|
||||
onMessageSend={async (msg) => {
|
||||
const draft = draftElementReferenceRef.current;
|
||||
const elementReferenceSnapshot: ElementReferenceSendSnapshot | undefined = draft
|
||||
? {
|
||||
reference: draft.reference,
|
||||
selectionVersion: draft.selectionVersion,
|
||||
}
|
||||
: undefined;
|
||||
// Always clear Level-1 pause state — the closure may hold a stale
|
||||
// isDiscussionPaused value (e.g. voice input's onTranscription callback
|
||||
// captures onMessageSend before React re-renders with the updated state).
|
||||
setIsDiscussionPaused(false);
|
||||
// Clear the sticky livePausedRef so the next agent-loop buffer
|
||||
// starts unpaused. (pauseActiveLiveBuffer sets a ref that new
|
||||
// buffers inherit — must be cleared before sendMessage creates one.)
|
||||
chatAreaRef.current?.resumeActiveLiveBuffer();
|
||||
// Flush any buffered / in-flight TTS audio from the previous
|
||||
// agent turn so it doesn't leak into the next round.
|
||||
discussionTTS.cleanup();
|
||||
// Clear soft-paused state — user is continuing the topic
|
||||
if (isTopicPending) {
|
||||
setIsTopicPending(false);
|
||||
setLiveSpeech(null);
|
||||
setSpeakingAgentId(null);
|
||||
}
|
||||
setChatIsSoftClosing(false);
|
||||
// User interrupts during playback — handleUserInterrupt triggers
|
||||
// onUserInterrupt callback which already calls sendMessage, so skip
|
||||
// the direct sendMessage below to avoid sending twice.
|
||||
// Include 'paused' because onInputActivate pauses the engine before
|
||||
// the user finishes typing — without this the interrupt position
|
||||
// would never be saved and resuming after QA skips to the next sentence.
|
||||
if (
|
||||
engineRef.current &&
|
||||
(engineMode === 'playing' || engineMode === 'live' || engineMode === 'paused')
|
||||
) {
|
||||
pendingInterruptElementReferenceRef.current = elementReferenceSnapshot;
|
||||
try {
|
||||
engineRef.current.handleUserInterrupt(msg);
|
||||
} finally {
|
||||
pendingInterruptElementReferenceRef.current = undefined;
|
||||
}
|
||||
} else {
|
||||
void sendMessageWithElementReference(msg, elementReferenceSnapshot);
|
||||
}
|
||||
// Auto-switch to chat tab when user sends a message
|
||||
chatAreaRef.current?.switchToTab('chat');
|
||||
setIsCueUser(false);
|
||||
// Immediately mark streaming for synchronized stop button
|
||||
setChatIsStreaming(true);
|
||||
setChatSessionType(chatSessionType || 'qa');
|
||||
// Optimistic thinking: show thinking dots immediately so there's
|
||||
// no blank gap between userMessage expiry and the SSE thinking event.
|
||||
// The real SSE event will overwrite this with the same or updated value.
|
||||
setThinkingState({ stage: 'director' });
|
||||
}}
|
||||
onDiscussionStart={() => {
|
||||
// User clicks "Join" on ProactiveCard
|
||||
engineRef.current?.confirmDiscussion();
|
||||
}}
|
||||
onDiscussionSkip={() => {
|
||||
// User clicks "Skip" on ProactiveCard
|
||||
engineRef.current?.skipDiscussion();
|
||||
}}
|
||||
onStopDiscussion={handleStopDiscussion}
|
||||
onContinueDiscussion={handleContinueDiscussion}
|
||||
onUserInputActivity={() => {
|
||||
handleContinueDiscussion();
|
||||
}}
|
||||
onInputActivate={() => {
|
||||
// Level-1 pause: freeze buffer tick + TTS audio while SSE keeps buffering.
|
||||
// User resumes manually via Space / pause button after closing the input.
|
||||
// No isDiscussionPaused guard — always attempt to pause the buffer.
|
||||
// The return value ensures UI state stays in sync with buffer state.
|
||||
if (chatSessionType === 'qa' || chatSessionType === 'discussion') {
|
||||
const paused = chatAreaRef.current?.pauseActiveLiveBuffer();
|
||||
if (paused) {
|
||||
discussionTTS.pause();
|
||||
setIsDiscussionPaused(true);
|
||||
}
|
||||
}
|
||||
// Also pause playback engine
|
||||
if (engineRef.current && (engineMode === 'playing' || engineMode === 'live')) {
|
||||
engineRef.current.pause();
|
||||
}
|
||||
}}
|
||||
onResumeTopic={doResumeTopic}
|
||||
onPlayPause={handlePlayPause}
|
||||
isDiscussionPaused={isDiscussionPaused}
|
||||
onDiscussionPause={() => {
|
||||
const paused = chatAreaRef.current?.pauseActiveLiveBuffer();
|
||||
if (paused) {
|
||||
discussionTTS.pause();
|
||||
setIsDiscussionPaused(true);
|
||||
}
|
||||
}}
|
||||
onDiscussionResume={() => {
|
||||
chatAreaRef.current?.resumeActiveLiveBuffer();
|
||||
discussionTTS.resume();
|
||||
setIsDiscussionPaused(false);
|
||||
}}
|
||||
totalActions={totalActions}
|
||||
currentActionIndex={currentPlaybackActionIndex ?? 0}
|
||||
currentSceneIndex={currentSceneIndex}
|
||||
scenesCount={totalScenesCount}
|
||||
whiteboardOpen={whiteboardOpen}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
chatCollapsed={chatAreaCollapsed}
|
||||
onToggleSidebar={() => setSidebarCollapsed(!sidebarCollapsed)}
|
||||
onToggleChat={() => setChatAreaCollapsed(!chatAreaCollapsed)}
|
||||
onPrevSlide={handlePreviousScene}
|
||||
onNextSlide={handleNextScene}
|
||||
onWhiteboardClose={handleWhiteboardToggle}
|
||||
isPresenting={isPresenting}
|
||||
controlsVisible={controlsVisible}
|
||||
onTogglePresentation={togglePresentation}
|
||||
onPresentationInteractionChange={setIsPresentationInteractionActive}
|
||||
fullscreenContainerRef={stageRef}
|
||||
showElementReference={showElementReference}
|
||||
canPickSlideElement={canPickSlideElement}
|
||||
elementPickActive={elementPickActive}
|
||||
onToggleElementPick={handleToggleElementPick}
|
||||
elementReferencePill={
|
||||
draftElementReference
|
||||
? {
|
||||
sceneLabel: t('chat.lectureNotes.pageLabel', {
|
||||
n: (draftElementReference.sceneOrder ?? 0) + 1,
|
||||
}),
|
||||
elementType: getSlideElementTypeLabel(draftElementReference.elementType, t),
|
||||
displaySummary: draftElementReference.displaySummary,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
onClearElementReference={() => setDraftElementReference(null)}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={stageRef}
|
||||
className={cn(
|
||||
'flex-1 flex overflow-hidden bg-gray-50 dark:bg-gray-900',
|
||||
'flex-1 flex overflow-hidden relative bg-gray-50 dark:bg-gray-900',
|
||||
isPresenting && !controlsVisible && 'cursor-none',
|
||||
)}
|
||||
>
|
||||
@ -1486,13 +1657,7 @@ export const PlaybackChromeRoot = forwardRef<PlaybackChromeRootHandle, PlaybackC
|
||||
{/* Canvas Area — playback-only renderer. The parent Stage swaps
|
||||
this whole PlaybackChromeRoot out when entering edit mode, so
|
||||
no inline branching is needed here. */}
|
||||
<div
|
||||
className="overflow-hidden relative flex-1 min-h-0 isolate"
|
||||
style={{
|
||||
height: sceneViewerHeight,
|
||||
}}
|
||||
suppressHydrationWarning
|
||||
>
|
||||
<div className="overflow-hidden relative flex-1 min-h-0 isolate" suppressHydrationWarning>
|
||||
<CanvasArea
|
||||
currentScene={currentScene}
|
||||
currentSceneIndex={currentSceneIndex}
|
||||
@ -1546,190 +1711,42 @@ export const PlaybackChromeRoot = forwardRef<PlaybackChromeRootHandle, PlaybackC
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Roundtable Area */}
|
||||
{mode === 'playback' && (
|
||||
{mode === 'playback' && !isPresenting && (
|
||||
<div
|
||||
className={cn(
|
||||
'transition-opacity duration-300',
|
||||
!isPresenting && 'shrink-0',
|
||||
isPresenting && 'absolute inset-x-0 bottom-0 z-20',
|
||||
)}
|
||||
ref={setPlaybackToolbarHost}
|
||||
className="shrink-0 border-t border-border bg-background"
|
||||
/>
|
||||
)}
|
||||
{mode === 'playback' && isPresenting && (
|
||||
<div className="absolute inset-x-0 bottom-0 z-20">{roundtable}</div>
|
||||
)}
|
||||
{!isPresenting && chatAreaCollapsed && (
|
||||
<button
|
||||
onClick={() => setChatAreaCollapsed(false)}
|
||||
className="absolute right-4 top-20 z-30 rounded-lg border border-border bg-background px-4 py-2 text-sm font-medium shadow-sm hover:bg-muted"
|
||||
>
|
||||
<Roundtable
|
||||
mode={mode}
|
||||
initialParticipants={participants}
|
||||
playbackView={playbackView}
|
||||
currentSpeech={liveSpeech}
|
||||
lectureSpeech={lectureSpeech}
|
||||
idleText={firstSpeechText}
|
||||
playbackCompleted={playbackCompleted}
|
||||
discussionRequest={discussionRequest}
|
||||
engineMode={engineMode}
|
||||
isStreaming={chatIsStreaming}
|
||||
audioIndicatorState={audioIndicatorState}
|
||||
audioAgentId={audioAgentId}
|
||||
sessionType={
|
||||
chatSessionType === 'qa'
|
||||
? 'qa'
|
||||
: chatSessionType === 'discussion'
|
||||
? 'discussion'
|
||||
: undefined
|
||||
}
|
||||
speakingAgentId={speakingAgentId}
|
||||
speechProgress={speechProgress}
|
||||
showEndFlash={showEndFlash}
|
||||
endFlashSessionType={endFlashSessionType}
|
||||
thinkingState={thinkingState}
|
||||
isCueUser={isCueUser}
|
||||
isSoftClosing={chatIsSoftClosing}
|
||||
softCloseDeadline={softCloseDeadline}
|
||||
isTopicPending={isTopicPending}
|
||||
onMessageSend={async (msg) => {
|
||||
const draft = draftElementReferenceRef.current;
|
||||
const elementReferenceSnapshot: ElementReferenceSendSnapshot | undefined = draft
|
||||
? {
|
||||
reference: draft.reference,
|
||||
selectionVersion: draft.selectionVersion,
|
||||
}
|
||||
: undefined;
|
||||
// Always clear Level-1 pause state — the closure may hold a stale
|
||||
// isDiscussionPaused value (e.g. voice input's onTranscription callback
|
||||
// captures onMessageSend before React re-renders with the updated state).
|
||||
setIsDiscussionPaused(false);
|
||||
// Clear the sticky livePausedRef so the next agent-loop buffer
|
||||
// starts unpaused. (pauseActiveLiveBuffer sets a ref that new
|
||||
// buffers inherit — must be cleared before sendMessage creates one.)
|
||||
chatAreaRef.current?.resumeActiveLiveBuffer();
|
||||
// Flush any buffered / in-flight TTS audio from the previous
|
||||
// agent turn so it doesn't leak into the next round.
|
||||
discussionTTS.cleanup();
|
||||
// Clear soft-paused state — user is continuing the topic
|
||||
if (isTopicPending) {
|
||||
setIsTopicPending(false);
|
||||
setLiveSpeech(null);
|
||||
setSpeakingAgentId(null);
|
||||
}
|
||||
setChatIsSoftClosing(false);
|
||||
// User interrupts during playback — handleUserInterrupt triggers
|
||||
// onUserInterrupt callback which already calls sendMessage, so skip
|
||||
// the direct sendMessage below to avoid sending twice.
|
||||
// Include 'paused' because onInputActivate pauses the engine before
|
||||
// the user finishes typing — without this the interrupt position
|
||||
// would never be saved and resuming after QA skips to the next sentence.
|
||||
if (
|
||||
engineRef.current &&
|
||||
(engineMode === 'playing' || engineMode === 'live' || engineMode === 'paused')
|
||||
) {
|
||||
pendingInterruptElementReferenceRef.current = elementReferenceSnapshot;
|
||||
try {
|
||||
engineRef.current.handleUserInterrupt(msg);
|
||||
} finally {
|
||||
pendingInterruptElementReferenceRef.current = undefined;
|
||||
}
|
||||
} else {
|
||||
void sendMessageWithElementReference(msg, elementReferenceSnapshot);
|
||||
}
|
||||
// Auto-switch to chat tab when user sends a message
|
||||
chatAreaRef.current?.switchToTab('chat');
|
||||
setIsCueUser(false);
|
||||
// Immediately mark streaming for synchronized stop button
|
||||
setChatIsStreaming(true);
|
||||
setChatSessionType(chatSessionType || 'qa');
|
||||
// Optimistic thinking: show thinking dots immediately so there's
|
||||
// no blank gap between userMessage expiry and the SSE thinking event.
|
||||
// The real SSE event will overwrite this with the same or updated value.
|
||||
setThinkingState({ stage: 'director' });
|
||||
}}
|
||||
onDiscussionStart={() => {
|
||||
// User clicks "Join" on ProactiveCard
|
||||
engineRef.current?.confirmDiscussion();
|
||||
}}
|
||||
onDiscussionSkip={() => {
|
||||
// User clicks "Skip" on ProactiveCard
|
||||
engineRef.current?.skipDiscussion();
|
||||
}}
|
||||
onStopDiscussion={handleStopDiscussion}
|
||||
onContinueDiscussion={handleContinueDiscussion}
|
||||
onUserInputActivity={() => {
|
||||
handleContinueDiscussion();
|
||||
}}
|
||||
onInputActivate={() => {
|
||||
// Level-1 pause: freeze buffer tick + TTS audio while SSE keeps buffering.
|
||||
// User resumes manually via Space / pause button after closing the input.
|
||||
// No isDiscussionPaused guard — always attempt to pause the buffer.
|
||||
// The return value ensures UI state stays in sync with buffer state.
|
||||
if (chatSessionType === 'qa' || chatSessionType === 'discussion') {
|
||||
const paused = chatAreaRef.current?.pauseActiveLiveBuffer();
|
||||
if (paused) {
|
||||
discussionTTS.pause();
|
||||
setIsDiscussionPaused(true);
|
||||
}
|
||||
}
|
||||
// Also pause playback engine
|
||||
if (engineRef.current && (engineMode === 'playing' || engineMode === 'live')) {
|
||||
engineRef.current.pause();
|
||||
}
|
||||
}}
|
||||
onResumeTopic={doResumeTopic}
|
||||
onPlayPause={handlePlayPause}
|
||||
isDiscussionPaused={isDiscussionPaused}
|
||||
onDiscussionPause={() => {
|
||||
const paused = chatAreaRef.current?.pauseActiveLiveBuffer();
|
||||
if (paused) {
|
||||
discussionTTS.pause();
|
||||
setIsDiscussionPaused(true);
|
||||
}
|
||||
}}
|
||||
onDiscussionResume={() => {
|
||||
chatAreaRef.current?.resumeActiveLiveBuffer();
|
||||
discussionTTS.resume();
|
||||
setIsDiscussionPaused(false);
|
||||
}}
|
||||
totalActions={totalActions}
|
||||
currentActionIndex={currentPlaybackActionIndex ?? 0}
|
||||
currentSceneIndex={currentSceneIndex}
|
||||
scenesCount={totalScenesCount}
|
||||
whiteboardOpen={whiteboardOpen}
|
||||
sidebarCollapsed={sidebarCollapsed}
|
||||
chatCollapsed={chatAreaCollapsed}
|
||||
onToggleSidebar={() => setSidebarCollapsed(!sidebarCollapsed)}
|
||||
onToggleChat={() => setChatAreaCollapsed(!chatAreaCollapsed)}
|
||||
onPrevSlide={handlePreviousScene}
|
||||
onNextSlide={handleNextScene}
|
||||
onWhiteboardClose={handleWhiteboardToggle}
|
||||
isPresenting={isPresenting}
|
||||
controlsVisible={controlsVisible}
|
||||
onTogglePresentation={togglePresentation}
|
||||
onPresentationInteractionChange={setIsPresentationInteractionActive}
|
||||
fullscreenContainerRef={stageRef}
|
||||
showElementReference={showElementReference}
|
||||
canPickSlideElement={canPickSlideElement}
|
||||
elementPickActive={elementPickActive}
|
||||
onToggleElementPick={handleToggleElementPick}
|
||||
elementReferencePill={
|
||||
draftElementReference
|
||||
? {
|
||||
sceneLabel: t('chat.lectureNotes.pageLabel', {
|
||||
n: (draftElementReference.sceneOrder ?? 0) + 1,
|
||||
}),
|
||||
elementType: getSlideElementTypeLabel(draftElementReference.elementType, t),
|
||||
displaySummary: draftElementReference.displaySummary,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
onClearElementReference={() => setDraftElementReference(null)}
|
||||
/>
|
||||
</div>
|
||||
打开课堂互动
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Chat Area — playback / autonomous always renders it here; Pro
|
||||
(edit) mode unmounts this whole PlaybackChromeRoot, so the
|
||||
edit branch has no chat. */}
|
||||
<div className="flex shrink-0">
|
||||
<div
|
||||
className={cn(
|
||||
'flex shrink-0 min-h-0 max-[899px]:absolute max-[899px]:inset-y-0 max-[899px]:right-0 max-[899px]:z-40',
|
||||
!chatAreaCollapsed && 'max-[899px]:shadow-2xl',
|
||||
)}
|
||||
>
|
||||
<ChatArea
|
||||
interaction={mode === 'playback' && !isPresenting ? roundtable : undefined}
|
||||
ref={chatAreaRef}
|
||||
width={chatAreaWidth}
|
||||
onOpenWhiteboard={() => {
|
||||
setWhiteboardOpenManually(true);
|
||||
if (window.innerWidth < 900) setChatAreaCollapsed(true);
|
||||
}}
|
||||
width={Math.max(380, Math.min(480, chatAreaWidth))}
|
||||
onWidthChange={setChatAreaWidth}
|
||||
collapsed={chatAreaCollapsed}
|
||||
onCollapseChange={setChatAreaCollapsed}
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
'use client';
|
||||
|
||||
import { BrandLogo } from '@/components/brand-logo';
|
||||
import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { AnimatePresence, Reorder, motion, useReducedMotion } from 'motion/react';
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useBrand, useIsDesktop } from '@/lib/brand/brand-context';
|
||||
import { useIsDesktop } from '@/lib/brand/brand-context';
|
||||
import { useStageStore } from '@/lib/store';
|
||||
import { useSettingsStore } from '@/lib/store/settings';
|
||||
import { useI18n } from '@/lib/hooks/use-i18n';
|
||||
@ -51,7 +52,6 @@ const RAIL_MAX_PX = 360;
|
||||
export function SlideNavRail() {
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const brand = useBrand();
|
||||
const isDesktop = useIsDesktop();
|
||||
const inWorkbenchPanel = useInWorkbenchPanel();
|
||||
const scenes = useStageStore.use.scenes();
|
||||
@ -408,7 +408,7 @@ export function SlideNavRail() {
|
||||
>
|
||||
{/* Desktop client: the Electron title bar already shows the brand icon + name, so the edit rail doesn't repeat it;
|
||||
returning home is handled by the edit bar's CommandBar back arrow. */}
|
||||
<img src={brand.logoSrc} alt={brand.productName} className="h-6 w-auto" />
|
||||
<BrandLogo />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -224,8 +224,8 @@ export function GenerationToolbar({
|
||||
// ─── Pill button helper ─────────────────────────────
|
||||
const pillCls =
|
||||
'inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium transition-all cursor-pointer select-none whitespace-nowrap border';
|
||||
const pillMuted = `${pillCls} border-border/50 text-muted-foreground/70 hover:text-foreground hover:bg-muted/60`;
|
||||
const pillActive = `${pillCls} border-violet-200/60 dark:border-violet-700/50 bg-violet-100 dark:bg-violet-900/30 text-violet-700 dark:text-violet-300`;
|
||||
const pillMuted = `${pillCls} border-border/50 text-muted-foreground hover:text-foreground hover:bg-muted/60`;
|
||||
const pillActive = `${pillCls} border-neutral-200/60 dark:border-neutral-700/50 bg-neutral-100 dark:bg-neutral-900/30 text-neutral-700 dark:text-neutral-300`;
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-1 flex-wrap">
|
||||
@ -350,8 +350,8 @@ export function GenerationToolbar({
|
||||
className={cn(
|
||||
'flex flex-col items-center justify-center rounded-lg border-2 border-dashed p-4 transition-colors',
|
||||
isDragging
|
||||
? 'border-violet-400 bg-violet-50 dark:bg-violet-950/20'
|
||||
: 'border-muted-foreground/20 hover:border-violet-300',
|
||||
? 'border-neutral-400 bg-neutral-50 dark:bg-neutral-950/20'
|
||||
: 'border-muted-foreground/20 hover:border-neutral-300',
|
||||
materialsLocked ? 'cursor-not-allowed opacity-50' : 'cursor-pointer',
|
||||
)}
|
||||
onClick={() => {
|
||||
@ -370,19 +370,19 @@ export function GenerationToolbar({
|
||||
if (files.length > 0) handleFilesSelect(files);
|
||||
}}
|
||||
>
|
||||
<Paperclip className="size-5 text-muted-foreground/50 mb-1.5" />
|
||||
<Paperclip className="size-5 text-muted-foreground mb-1.5" />
|
||||
<p className="text-xs font-medium">{t('toolbar.courseMaterialUpload')}</p>
|
||||
<p className="text-[10px] text-muted-foreground/60 mt-0.5 text-center">
|
||||
<p className="text-[10px] text-muted-foreground mt-0.5 text-center">
|
||||
{t('upload.courseMaterialSizeLimit')}
|
||||
</p>
|
||||
<p className="text-[10px] text-muted-foreground/60 text-center">
|
||||
<p className="text-[10px] text-muted-foreground text-center">
|
||||
{t('upload.courseMaterialCountLimit', { n: MAX_DOCUMENT_BUNDLE_FILES })}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{courseMaterials.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<p className="text-[10px] text-muted-foreground/70">
|
||||
<p className="text-[10px] text-muted-foreground">
|
||||
{t('toolbar.courseMaterialMergeOrder')}
|
||||
</p>
|
||||
<div className="max-h-44 space-y-2 overflow-y-auto pr-1">
|
||||
@ -393,8 +393,8 @@ export function GenerationToolbar({
|
||||
key={file.id}
|
||||
className="flex items-center gap-2 rounded-lg border border-border/50 px-2 py-2"
|
||||
>
|
||||
<div className="size-8 rounded-lg bg-violet-100 dark:bg-violet-900/30 flex items-center justify-center shrink-0">
|
||||
<FileText className="size-4 text-violet-600 dark:text-violet-400" />
|
||||
<div className="size-8 rounded-lg bg-neutral-100 dark:bg-neutral-900/30 flex items-center justify-center shrink-0">
|
||||
<FileText className="size-4 text-neutral-600 dark:text-neutral-400" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-sm font-medium truncate">
|
||||
@ -453,7 +453,7 @@ export function GenerationToolbar({
|
||||
className={cn(
|
||||
'w-full flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-all',
|
||||
webSearch
|
||||
? 'bg-violet-50 dark:bg-violet-950/20 border-violet-200 dark:border-violet-800'
|
||||
? 'bg-neutral-50 dark:bg-neutral-950/20 border-neutral-200 dark:border-neutral-800'
|
||||
: 'border-border hover:bg-muted/50',
|
||||
!selectedWebSearchAvailable && 'opacity-60',
|
||||
materialsLocked && 'opacity-60 cursor-not-allowed',
|
||||
@ -462,14 +462,14 @@ export function GenerationToolbar({
|
||||
<Globe2
|
||||
className={cn(
|
||||
'size-4 shrink-0',
|
||||
webSearch ? 'text-violet-600 dark:text-violet-400' : 'text-muted-foreground',
|
||||
webSearch ? 'text-neutral-600 dark:text-neutral-400' : 'text-muted-foreground',
|
||||
)}
|
||||
/>
|
||||
<div className="flex-1 min-w-0">
|
||||
<p className="text-xs font-medium">
|
||||
{webSearch ? t('toolbar.webSearchOn') : t('toolbar.webSearchOff')}
|
||||
</p>
|
||||
<p className="text-[10px] text-muted-foreground/70 mt-0.5">
|
||||
<p className="text-[10px] text-muted-foreground mt-0.5">
|
||||
{t('toolbar.webSearchDesc')}
|
||||
</p>
|
||||
</div>
|
||||
@ -514,10 +514,7 @@ export function GenerationToolbar({
|
||||
) : (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
className={cn(pillCls, 'text-muted-foreground/40 cursor-not-allowed')}
|
||||
disabled
|
||||
>
|
||||
<button className={cn(pillCls, 'text-muted-foreground cursor-not-allowed')} disabled>
|
||||
<Globe2 className="size-3.5" />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
@ -607,7 +604,7 @@ function InlineThinkingControl({
|
||||
};
|
||||
|
||||
const selectTriggerCls =
|
||||
'h-6 min-w-[84px] rounded-full border-0 bg-violet-100 px-2 py-0 !text-[10px] font-medium leading-none text-violet-700 shadow-none focus-visible:ring-0 data-[size=sm]:h-6 dark:bg-violet-900/40 dark:text-violet-200 [&_svg]:size-3';
|
||||
'h-6 min-w-[84px] rounded-full border-0 bg-neutral-100 px-2 py-0 !text-[10px] font-medium leading-none text-neutral-700 shadow-none focus-visible:ring-0 data-[size=sm]:h-6 dark:bg-neutral-900/40 dark:text-neutral-200 [&_svg]:size-3';
|
||||
const selectItemCls = 'py-1 text-xs';
|
||||
const hasAutoBudget =
|
||||
(thinking.control === 'toggle-budget' || thinking.control === 'budget-only') &&
|
||||
@ -633,8 +630,8 @@ function InlineThinkingControl({
|
||||
onPointerDown={(event) => event.stopPropagation()}
|
||||
onKeyDown={(event) => event.stopPropagation()}
|
||||
>
|
||||
<Brain className="size-3.5 shrink-0 text-violet-500" />
|
||||
<div className="flex min-w-0 items-center gap-0.5 rounded-full border border-violet-200/70 bg-white/65 p-0.5 dark:border-violet-800/70 dark:bg-violet-950/25">
|
||||
<Brain className="size-3.5 shrink-0 text-neutral-500" />
|
||||
<div className="flex min-w-0 items-center gap-0.5 rounded-full border border-neutral-200/70 bg-white/65 p-0.5 dark:border-neutral-800/70 dark:bg-neutral-950/25">
|
||||
{hasAutoBudget && (
|
||||
<Select
|
||||
value={autoBudgetMode}
|
||||
@ -642,7 +639,7 @@ function InlineThinkingControl({
|
||||
>
|
||||
<SelectTrigger
|
||||
size="sm"
|
||||
className="h-6 min-w-[76px] rounded-full border-0 bg-violet-100 px-2 py-0 !text-[10px] font-medium leading-none text-violet-700 shadow-none focus-visible:ring-0 data-[size=sm]:h-6 dark:bg-violet-900/40 dark:text-violet-200 [&_svg]:size-3"
|
||||
className="h-6 min-w-[76px] rounded-full border-0 bg-neutral-100 px-2 py-0 !text-[10px] font-medium leading-none text-neutral-700 shadow-none focus-visible:ring-0 data-[size=sm]:h-6 dark:bg-neutral-900/40 dark:text-neutral-200 [&_svg]:size-3"
|
||||
>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
@ -671,7 +668,7 @@ function InlineThinkingControl({
|
||||
>
|
||||
<SelectTrigger
|
||||
size="sm"
|
||||
className="h-6 min-w-[76px] rounded-full border-0 bg-violet-100 px-2 py-0 !text-[10px] font-medium leading-none text-violet-700 shadow-none focus-visible:ring-0 data-[size=sm]:h-6 dark:bg-violet-900/40 dark:text-violet-200 [&_svg]:size-3"
|
||||
className="h-6 min-w-[76px] rounded-full border-0 bg-neutral-100 px-2 py-0 !text-[10px] font-medium leading-none text-neutral-700 shadow-none focus-visible:ring-0 data-[size=sm]:h-6 dark:bg-neutral-900/40 dark:text-neutral-200 [&_svg]:size-3"
|
||||
>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
@ -738,8 +735,8 @@ function InlineThinkingControl({
|
||||
{(thinking.control === 'toggle-budget' || thinking.control === 'budget-only') &&
|
||||
thinking.budgetRange &&
|
||||
(!hasAutoBudget || autoBudgetMode === 'enabled') && (
|
||||
<label className="ml-0.5 grid h-6 shrink-0 grid-cols-[auto_60px] items-stretch overflow-hidden rounded-full border border-violet-200/70 bg-background dark:border-violet-800/70">
|
||||
<span className="grid h-[22px] shrink-0 place-items-center border-r border-violet-200/70 bg-muted/30 px-2 font-sans text-[11px] font-medium leading-[22px] text-muted-foreground dark:border-violet-800/70">
|
||||
<label className="ml-0.5 grid h-6 shrink-0 grid-cols-[auto_60px] items-stretch overflow-hidden rounded-full border border-neutral-200/70 bg-background dark:border-neutral-800/70">
|
||||
<span className="grid h-[22px] shrink-0 place-items-center border-r border-neutral-200/70 bg-muted/30 px-2 font-sans text-[11px] font-medium leading-[22px] text-muted-foreground dark:border-neutral-800/70">
|
||||
{t('toolbar.thinkingBudget')}
|
||||
</span>
|
||||
<input
|
||||
@ -868,7 +865,7 @@ function ModelSettingsPopover({
|
||||
aria-label={`${currentProviderName} / ${currentModelLabel}`}
|
||||
className={cn(
|
||||
'inline-flex h-8 min-w-0 items-center gap-1.5 rounded-full border px-2 text-xs font-medium transition-all',
|
||||
'border-violet-200/70 bg-violet-50 text-violet-700 hover:bg-violet-100 dark:border-violet-800/70 dark:bg-violet-950/30 dark:text-violet-300',
|
||||
'border-neutral-200/70 bg-neutral-50 text-neutral-700 hover:bg-neutral-100 dark:border-neutral-800/70 dark:bg-neutral-950/30 dark:text-neutral-300',
|
||||
currentModelId &&
|
||||
'shadow-[0_0_0_1px_rgba(124,58,237,0.12)] dark:shadow-[0_0_0_1px_rgba(167,139,250,0.16)]',
|
||||
)}
|
||||
@ -883,7 +880,7 @@ function ModelSettingsPopover({
|
||||
<Bot className="size-3.5 shrink-0" />
|
||||
)}
|
||||
{currentThinkingLabel && (
|
||||
<span className="shrink-0 rounded-full bg-white/80 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-violet-700 ring-1 ring-violet-200/70 dark:bg-violet-950/50 dark:text-violet-200 dark:ring-violet-800/70">
|
||||
<span className="shrink-0 rounded-full bg-white/80 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-neutral-700 ring-1 ring-neutral-200/70 dark:bg-neutral-950/50 dark:text-neutral-200 dark:ring-neutral-800/70">
|
||||
{currentThinkingLabel}
|
||||
</span>
|
||||
)}
|
||||
@ -943,7 +940,7 @@ function ModelSettingsPopover({
|
||||
{provider.models.length}
|
||||
</div>
|
||||
</div>
|
||||
{isCurrent && <span className="size-1.5 rounded-full bg-violet-500" />}
|
||||
{isCurrent && <span className="size-1.5 rounded-full bg-neutral-500" />}
|
||||
</button>
|
||||
);
|
||||
})
|
||||
@ -997,7 +994,7 @@ function ModelSettingsPopover({
|
||||
className={cn(
|
||||
'mb-1 flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors',
|
||||
isSelected
|
||||
? 'bg-violet-50 text-violet-700 ring-1 ring-violet-200 dark:bg-violet-950/25 dark:text-violet-300 dark:ring-violet-800'
|
||||
? 'bg-neutral-50 text-neutral-700 ring-1 ring-neutral-200 dark:bg-neutral-950/25 dark:text-neutral-300 dark:ring-neutral-800'
|
||||
: 'hover:bg-muted/60',
|
||||
)}
|
||||
>
|
||||
@ -1018,7 +1015,7 @@ function ModelSettingsPopover({
|
||||
/>
|
||||
)}
|
||||
{isSelected && (
|
||||
<Check className="size-3.5 shrink-0 text-violet-600 dark:text-violet-400" />
|
||||
<Check className="size-3.5 shrink-0 text-neutral-600 dark:text-neutral-400" />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -34,19 +34,13 @@ export const InteractiveModeButton = forwardRef<HTMLButtonElement, InteractiveMo
|
||||
if (!event.defaultPrevented) onPressedChange(!pressed);
|
||||
}}
|
||||
className={cn(
|
||||
'relative inline-flex h-8 shrink-0 cursor-pointer select-none items-center gap-1.5 whitespace-nowrap rounded-full border px-3 py-1.5 text-xs font-medium transition-all active:scale-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-700 motion-reduce:transition-none motion-reduce:active:scale-100 dark:focus-visible:outline-cyan-300',
|
||||
'relative inline-flex h-8 shrink-0 cursor-pointer select-none items-center gap-1.5 whitespace-nowrap rounded-md border px-3 py-1.5 text-xs font-medium transition-all active:scale-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-reduce:transition-none motion-reduce:active:scale-100',
|
||||
pressed
|
||||
? 'border-cyan-400 bg-cyan-100 text-cyan-900 shadow-sm shadow-cyan-200/60 dark:border-cyan-200 dark:bg-cyan-400 dark:text-slate-950 dark:shadow-[0_0_18px_rgba(34,211,238,0.45)]'
|
||||
: 'border-cyan-600 bg-transparent text-cyan-700 hover:bg-cyan-50 dark:border-cyan-700 dark:text-cyan-300 dark:hover:bg-cyan-950/50',
|
||||
? 'border-primary bg-primary text-primary-foreground'
|
||||
: 'border-input bg-background text-foreground hover:bg-muted',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{pressed && (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute inset-[-4px] rounded-full border border-cyan-300/40 dark:border-cyan-300/60 motion-safe:dark:animate-[interactive-mode-breathe_2s_ease-in-out_infinite]"
|
||||
/>
|
||||
)}
|
||||
{pressed ? (
|
||||
<Check aria-hidden="true" className="relative z-10 size-3.5" />
|
||||
) : (
|
||||
|
||||
@ -241,7 +241,7 @@ export function MediaPopover({ onSettingsOpen }: MediaPopoverProps) {
|
||||
className={cn(
|
||||
'inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium transition-all cursor-pointer select-none whitespace-nowrap border',
|
||||
enabledCount > 0
|
||||
? 'bg-violet-100 dark:bg-violet-900/30 text-violet-700 dark:text-violet-300 border-violet-200/60 dark:border-violet-700/50'
|
||||
? 'bg-neutral-100 dark:bg-neutral-900/30 text-neutral-700 dark:text-neutral-300 border-neutral-200/60 dark:border-neutral-700/50'
|
||||
: 'text-muted-foreground/70 hover:text-foreground hover:bg-muted/60 border-border/50',
|
||||
)}
|
||||
>
|
||||
@ -275,7 +275,7 @@ export function MediaPopover({ onSettingsOpen }: MediaPopoverProps) {
|
||||
<Icon className="size-3.5" />
|
||||
<span className="hidden sm:inline">{tab.label}</span>
|
||||
{isEnabled && !isActive && (
|
||||
<span className="absolute top-1 right-1 size-1.5 rounded-full bg-violet-500" />
|
||||
<span className="absolute top-1 right-1 size-1.5 rounded-full bg-neutral-500" />
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
@ -390,7 +390,7 @@ function TabPanel({
|
||||
<Icon
|
||||
className={cn(
|
||||
'size-4 shrink-0 transition-colors',
|
||||
enabled ? 'text-violet-600 dark:text-violet-400' : 'text-muted-foreground/50',
|
||||
enabled ? 'text-neutral-600 dark:text-neutral-400' : 'text-muted-foreground/50',
|
||||
)}
|
||||
/>
|
||||
<span
|
||||
|
||||
@ -65,10 +65,10 @@ const TYPE_THEME: Record<
|
||||
dot: 'bg-blue-400',
|
||||
},
|
||||
quiz: {
|
||||
chip: 'bg-purple-50 text-purple-600 dark:bg-purple-500/10 dark:text-purple-300',
|
||||
chipHover: 'hover:bg-purple-100/80 dark:hover:bg-purple-500/15',
|
||||
accent: 'bg-purple-500',
|
||||
dot: 'bg-purple-400',
|
||||
chip: 'bg-neutral-50 text-neutral-600 dark:bg-neutral-500/10 dark:text-neutral-300',
|
||||
chipHover: 'hover:bg-neutral-100/80 dark:hover:bg-neutral-500/15',
|
||||
accent: 'bg-neutral-500',
|
||||
dot: 'bg-neutral-400',
|
||||
},
|
||||
interactive: {
|
||||
chip: 'bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-300',
|
||||
@ -239,7 +239,7 @@ export function OutlinesEditor({
|
||||
className={cn(
|
||||
'relative overflow-hidden rounded-3xl border border-border/40',
|
||||
'bg-white/85 shadow-[0_30px_80px_-30px_rgba(15,23,42,0.25)] backdrop-blur-xl',
|
||||
'dark:border-white/5 dark:bg-slate-950/70 dark:shadow-[0_30px_80px_-30px_rgba(0,0,0,0.6)]',
|
||||
'dark:border-white/5 dark:bg-neutral-950/70 dark:shadow-[0_30px_80px_-30px_rgba(0,0,0,0.6)]',
|
||||
)}
|
||||
>
|
||||
{/* Soft gradient wash */}
|
||||
@ -527,8 +527,8 @@ function SceneRow({
|
||||
}}
|
||||
className={cn(
|
||||
'group/scene relative rounded-2xl px-3 py-3.5 transition-colors md:px-4',
|
||||
'hover:bg-slate-50/60 dark:hover:bg-slate-800/30',
|
||||
'focus-within:bg-slate-50/80 dark:focus-within:bg-slate-800/40',
|
||||
'hover:bg-neutral-50/60 dark:hover:bg-neutral-800/30',
|
||||
'focus-within:bg-neutral-50/80 dark:focus-within:bg-neutral-800/40',
|
||||
isDragging && 'opacity-40',
|
||||
isDragTarget && 'bg-blue-500/[0.04] ring-1 ring-blue-400/40',
|
||||
)}
|
||||
@ -1117,7 +1117,7 @@ function QuizConfigDisclosure({
|
||||
'flex-1 rounded-md px-2 py-1.5 text-xs font-medium transition-all',
|
||||
'border',
|
||||
selected
|
||||
? 'border-purple-500/40 bg-purple-500/10 text-purple-700 dark:text-purple-200'
|
||||
? 'border-neutral-500/40 bg-neutral-500/10 text-neutral-700 dark:text-neutral-200'
|
||||
: 'border-border/40 bg-transparent text-muted-foreground hover:border-border hover:bg-muted/60 hover:text-foreground',
|
||||
isOnlySelected && 'cursor-not-allowed opacity-90',
|
||||
)}
|
||||
|
||||
@ -49,14 +49,14 @@ export function Header({
|
||||
|
||||
return (
|
||||
<>
|
||||
<header className="h-20 px-8 flex items-center justify-between z-10 bg-transparent gap-4">
|
||||
<header className="min-h-16 px-4 md:px-6 py-2 flex items-center justify-between z-10 bg-background border-b border-border gap-2 flex-wrap">
|
||||
<div className="flex items-center gap-3 min-w-0 flex-1">
|
||||
{hideBackControl
|
||||
? null
|
||||
: (backControl ?? (
|
||||
<button
|
||||
onClick={() => exitClassroom(router, searchParams)}
|
||||
className="shrink-0 p-2 rounded-lg text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300 transition-colors"
|
||||
className="shrink-0 p-2 rounded-lg text-neutral-400 dark:text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800 hover:text-neutral-700 dark:hover:text-neutral-300 transition-colors"
|
||||
title={exitLabel}
|
||||
aria-label={exitLabel}
|
||||
>
|
||||
@ -74,11 +74,11 @@ export function Header({
|
||||
CommandBar title during the cross-fade. */}
|
||||
{mode !== 'edit' && (
|
||||
<div className="flex flex-col min-w-0">
|
||||
<span className="text-[10px] uppercase tracking-widest font-bold text-gray-400 dark:text-gray-500 mb-0.5">
|
||||
<span className="text-[10px] uppercase tracking-widest font-bold text-neutral-400 dark:text-neutral-500 mb-0.5">
|
||||
{t('stage.currentScene')}
|
||||
</span>
|
||||
<h1
|
||||
className="text-xl font-bold text-gray-800 dark:text-gray-200 tracking-tight truncate"
|
||||
className="text-base font-semibold text-neutral-800 dark:text-neutral-200 tracking-tight truncate"
|
||||
suppressHydrationWarning
|
||||
>
|
||||
{currentSceneTitle || t('common.loading')}
|
||||
|
||||
@ -32,7 +32,7 @@ export function LanguageSwitcher({ onOpen }: LanguageSwitcherProps) {
|
||||
}}
|
||||
>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className="flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-bold text-gray-500 dark:text-gray-400 hover:bg-white dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 hover:shadow-sm transition-all">
|
||||
<button className="flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-bold text-neutral-500 dark:text-neutral-400 hover:bg-white dark:hover:bg-neutral-700 hover:text-neutral-800 dark:hover:text-neutral-200 hover:shadow-sm transition-all">
|
||||
{supportedLocales.find((l) => l.code === locale)?.shortLabel ?? locale}
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
@ -44,7 +44,7 @@ export function LanguageSwitcher({ onOpen }: LanguageSwitcherProps) {
|
||||
className={cn(
|
||||
'cursor-pointer',
|
||||
locale === l.code &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400',
|
||||
'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-600 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
{l.label}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useState, useRef, useCallback, useEffect } from 'react';
|
||||
import { motion, AnimatePresence } from 'motion/react';
|
||||
import {
|
||||
@ -42,6 +43,8 @@ export interface DiscussionRequest {
|
||||
}
|
||||
|
||||
interface RoundtableProps {
|
||||
readonly layout?: 'stage' | 'sidebar';
|
||||
readonly toolbarContainer?: HTMLDivElement | null;
|
||||
readonly mode?: 'playback' | 'autonomous';
|
||||
readonly initialParticipants?: Participant[];
|
||||
readonly playbackView?: PlaybackView; // Centralised derived state from Stage
|
||||
@ -150,6 +153,8 @@ function VoiceWaveformBars({ barClassName }: { readonly barClassName: string })
|
||||
}
|
||||
|
||||
export function Roundtable({
|
||||
layout = 'stage',
|
||||
toolbarContainer,
|
||||
mode: _mode = 'autonomous',
|
||||
initialParticipants = [],
|
||||
playbackView,
|
||||
@ -667,7 +672,7 @@ export function Roundtable({
|
||||
isProcessing;
|
||||
const toolbar = (
|
||||
<CanvasToolbar
|
||||
className="shrink-0 h-8 px-3 border-b border-gray-100/40 dark:border-gray-700/30"
|
||||
className="shrink-0 h-8 px-3 border-b border-neutral-100/40 dark:border-neutral-700/30"
|
||||
currentSceneIndex={currentSceneIndex}
|
||||
scenesCount={scenesCount}
|
||||
engineState={
|
||||
@ -712,20 +717,20 @@ export function Roundtable({
|
||||
const referencePill = elementReferencePill ? (
|
||||
<div
|
||||
data-testid="slide-element-reference-pill"
|
||||
className="pointer-events-auto flex max-w-[min(520px,calc(100vw-3rem))] items-center gap-2 rounded-full border border-violet-200 bg-white/95 px-3 py-1.5 text-xs shadow-lg backdrop-blur dark:border-violet-700 dark:bg-gray-900/95"
|
||||
className="pointer-events-auto flex max-w-[min(520px,calc(100vw-3rem))] items-center gap-2 rounded-full border border-neutral-200 bg-white/95 px-3 py-1.5 text-xs shadow-lg backdrop-blur dark:border-neutral-700 dark:bg-neutral-900/95"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
<Quote className="h-3.5 w-3.5 shrink-0 text-violet-600 dark:text-violet-400" />
|
||||
<span className="shrink-0 font-semibold text-violet-700 dark:text-violet-300">
|
||||
<Quote className="h-3.5 w-3.5 shrink-0 text-neutral-600 dark:text-neutral-400" />
|
||||
<span className="shrink-0 font-semibold text-neutral-700 dark:text-neutral-300">
|
||||
{elementReferencePill.sceneLabel} · {elementReferencePill.elementType} ·
|
||||
</span>
|
||||
<span className="min-w-0 truncate text-gray-600 dark:text-gray-300">
|
||||
<span className="min-w-0 truncate text-neutral-600 dark:text-neutral-300">
|
||||
{elementReferencePill.displaySummary}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClearElementReference}
|
||||
className="-mr-1 rounded-full p-0.5 text-gray-400 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-800 dark:hover:text-gray-200"
|
||||
className="-mr-1 rounded-full p-0.5 text-neutral-400 hover:bg-neutral-100 hover:text-neutral-700 dark:hover:bg-neutral-800 dark:hover:text-neutral-200"
|
||||
aria-label={t('chat.elementReference.clear')}
|
||||
>
|
||||
<X className="h-3.5 w-3.5" />
|
||||
@ -769,7 +774,7 @@ export function Roundtable({
|
||||
)}
|
||||
style={{ right: chatCollapsed === false ? (chatAreaWidth ?? 320) : 0 }}
|
||||
>
|
||||
<div className="mb-3 px-2 py-1 rounded-full bg-white/70 dark:bg-black/60 backdrop-blur-xl border border-gray-200/60 dark:border-white/10 shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] pointer-events-auto">
|
||||
<div className="mb-3 px-2 py-1 rounded-full bg-white/70 dark:bg-black/60 border border-neutral-200/60 dark:border-white/10 shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] pointer-events-auto">
|
||||
{toolbar}
|
||||
</div>
|
||||
</div>
|
||||
@ -789,12 +794,12 @@ export function Roundtable({
|
||||
times: [0, 0.15, 0.7, 1],
|
||||
ease: 'easeOut',
|
||||
}}
|
||||
className="fixed bottom-20 -translate-x-1/2 z-[50] bg-gray-100/80 dark:bg-gray-800/80 backdrop-blur-md text-gray-700 dark:text-white px-3.5 py-1.5 rounded-full text-xs font-medium pointer-events-none"
|
||||
className="fixed bottom-20 -translate-x-1/2 z-[50] bg-neutral-100/80 dark:bg-neutral-800/80 text-neutral-700 dark:text-white px-3.5 py-1.5 rounded-full text-xs font-medium pointer-events-none"
|
||||
style={{
|
||||
left: `calc((100vw - ${chatCollapsed === false ? (chatAreaWidth ?? 320) : 0}px) / 2)`,
|
||||
}}
|
||||
>
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-gray-400 inline-block mr-1.5" />
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-neutral-400 inline-block mr-1.5" />
|
||||
{endFlashSessionType === 'discussion'
|
||||
? t('roundtable.discussionEnded')
|
||||
: t('roundtable.qaEnded')}
|
||||
@ -818,7 +823,7 @@ export function Roundtable({
|
||||
exit={{ opacity: 0, scale: 0.95, y: 15, filter: 'blur(4px)' }}
|
||||
className="w-[min(480px,calc(100vw-3rem))] pointer-events-auto"
|
||||
>
|
||||
<div className="flex items-center gap-3 bg-white/70 dark:bg-black/60 backdrop-blur-xl rounded-full px-4 py-2 shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] border border-gray-200/60 dark:border-white/10">
|
||||
<div className="flex items-center gap-3 bg-white/70 dark:bg-black/60 rounded-full px-4 py-2 shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] border border-neutral-200/60 dark:border-white/10">
|
||||
<div className="flex-1 min-w-0 flex items-center">
|
||||
<textarea
|
||||
value={inputValue}
|
||||
@ -834,7 +839,7 @@ export function Roundtable({
|
||||
placeholder={t('roundtable.inputPlaceholder')}
|
||||
autoFocus
|
||||
rows={1}
|
||||
className="w-full resize-none bg-transparent border-none focus:ring-0 focus:outline-none outline-none shadow-none ring-0 text-gray-900 dark:text-white text-sm placeholder:text-gray-400 dark:placeholder:text-gray-400 py-0 leading-[40px] max-h-[80px]"
|
||||
className="w-full resize-none bg-transparent border-none focus:ring-0 focus:outline-none outline-none shadow-none ring-0 text-neutral-900 dark:text-white text-sm placeholder:text-neutral-400 dark:placeholder:text-neutral-400 py-0 leading-[40px] max-h-[80px]"
|
||||
style={{ fieldSizing: 'content' } as Record<string, string>}
|
||||
/>
|
||||
</div>
|
||||
@ -844,8 +849,8 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0',
|
||||
isSendCooldown
|
||||
? 'bg-gray-500/50 cursor-not-allowed'
|
||||
: 'bg-purple-600 hover:bg-purple-700 shadow-[0_4px_16px_rgba(147,51,234,0.3)]',
|
||||
? 'bg-neutral-500/50 cursor-not-allowed'
|
||||
: 'bg-neutral-600 hover:bg-neutral-700 shadow-[0_4px_16px_rgba(0,0,0,0.08)]',
|
||||
)}
|
||||
>
|
||||
{isSendCooldown ? (
|
||||
@ -869,12 +874,12 @@ export function Roundtable({
|
||||
exit={{ opacity: 0, scale: 0.9, y: 20, filter: 'blur(4px)' }}
|
||||
className="pointer-events-auto"
|
||||
>
|
||||
<div className="flex items-center gap-4 bg-white/70 dark:bg-black/60 backdrop-blur-xl rounded-full px-5 py-3 shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] border border-gray-200/60 dark:border-white/10">
|
||||
<div className="flex items-center gap-4 bg-white/70 dark:bg-black/60 rounded-full px-5 py-3 shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] border border-neutral-200/60 dark:border-white/10">
|
||||
{/* Waveform bars */}
|
||||
<div className="flex items-center gap-0.5 h-8">
|
||||
<VoiceWaveformBars barClassName="bg-gradient-to-t from-purple-400 to-indigo-400" />
|
||||
<VoiceWaveformBars barClassName="bg-gradient-to-t from-neutral-400 to-neutral-400" />
|
||||
</div>
|
||||
<span className="text-[11px] font-semibold tracking-wider text-purple-600 dark:text-purple-300 uppercase">
|
||||
<span className="text-[11px] font-semibold tracking-wider text-neutral-600 dark:text-neutral-300 uppercase">
|
||||
{isProcessing ? t('roundtable.processing') : t('roundtable.listening')}
|
||||
</span>
|
||||
{/* Mic button */}
|
||||
@ -886,10 +891,10 @@ export function Roundtable({
|
||||
className="relative group cursor-pointer bg-transparent border-none p-0"
|
||||
onClick={handleToggleVoice}
|
||||
>
|
||||
<div className="relative w-12 h-12 rounded-full bg-gradient-to-br from-purple-600 to-indigo-700 shadow-[0_4px_20px_rgba(147,51,234,0.3)] flex items-center justify-center group-hover:scale-105 transition-transform duration-300 border border-white/20">
|
||||
<div className="relative w-12 h-12 rounded-full bg-gradient-to-br from-neutral-600 to-neutral-700 shadow-[0_4px_20px_rgba(0,0,0,0.08)] flex items-center justify-center group-hover:scale-105 transition-transform duration-300 border border-white/20">
|
||||
<Mic className="w-5 h-5 text-white" />
|
||||
</div>
|
||||
<div className="absolute inset-0 rounded-full border-2 border-purple-500 opacity-40 animate-[ping_2s_ease-in-out_infinite]" />
|
||||
<div className="absolute inset-0 rounded-full border-2 border-neutral-500 opacity-40 animate-[ping_2s_ease-in-out_infinite]" />
|
||||
</button>
|
||||
</div>
|
||||
</motion.div>
|
||||
@ -909,7 +914,7 @@ export function Roundtable({
|
||||
>
|
||||
<button
|
||||
onClick={() => (asrEnabled ? handleToggleVoice() : handleToggleInput())}
|
||||
className="flex items-center gap-2 px-5 py-2.5 rounded-full bg-white/70 dark:bg-black/50 backdrop-blur-xl border border-amber-400/50 dark:border-amber-500/50 shadow-[0_0_16px_rgba(245,158,11,0.2),0_8px_32px_rgba(0,0,0,0.06)] dark:shadow-[0_0_16px_rgba(245,158,11,0.25),0_8px_32px_rgba(0,0,0,0.4)] text-amber-600 dark:text-amber-400 text-sm font-semibold tracking-wide hover:bg-gray-100/80 dark:hover:bg-black/60 hover:border-amber-500/70 dark:hover:border-amber-400/70 hover:shadow-[0_0_24px_rgba(245,158,11,0.25)] dark:hover:shadow-[0_0_24px_rgba(245,158,11,0.35)] transition-all active:scale-95 animate-pulse"
|
||||
className="flex items-center gap-2 px-5 py-2.5 rounded-full bg-white/70 dark:bg-black/50 border border-amber-400/50 dark:border-amber-500/50 shadow-[0_0_16px_rgba(245,158,11,0.2),0_8px_32px_rgba(0,0,0,0.06)] dark:shadow-[0_0_16px_rgba(245,158,11,0.25),0_8px_32px_rgba(0,0,0,0.4)] text-amber-600 dark:text-amber-400 text-sm font-semibold tracking-wide hover:bg-neutral-100/80 dark:hover:bg-black/60 hover:border-amber-500/70 dark:hover:border-amber-400/70 hover:shadow-[0_0_24px_rgba(245,158,11,0.25)] dark:hover:shadow-[0_0_24px_rgba(245,158,11,0.35)] transition-all active:scale-95 animate-pulse"
|
||||
>
|
||||
{asrEnabled ? <Mic className="w-4 h-4" /> : <MessageSquare className="w-4 h-4" />}
|
||||
{t('roundtable.yourTurn')}
|
||||
@ -925,7 +930,7 @@ export function Roundtable({
|
||||
initial={{ opacity: 0, scale: 0.9 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.9 }}
|
||||
className="flex items-center gap-2 px-4 py-2 bg-white/70 dark:bg-black/50 backdrop-blur-xl rounded-full border border-gray-200/60 dark:border-white/10"
|
||||
className="flex items-center gap-2 px-4 py-2 bg-white/70 dark:bg-black/50 rounded-full border border-neutral-200/60 dark:border-white/10"
|
||||
>
|
||||
<div className="flex gap-1">
|
||||
{[0, 0.2, 0.4].map((delay) => (
|
||||
@ -933,11 +938,11 @@ export function Roundtable({
|
||||
key={delay}
|
||||
animate={{ opacity: [0.3, 1, 0.3] }}
|
||||
transition={{ repeat: Infinity, duration: 1.2, delay }}
|
||||
className="w-1.5 h-1.5 rounded-full bg-purple-400"
|
||||
className="w-1.5 h-1.5 rounded-full bg-neutral-400"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<span className="text-[10px] text-gray-500 dark:text-gray-400 font-medium">
|
||||
<span className="text-[10px] text-neutral-500 dark:text-neutral-400 font-medium">
|
||||
{t('roundtable.thinking')}
|
||||
</span>
|
||||
</motion.div>
|
||||
@ -976,7 +981,7 @@ export function Roundtable({
|
||||
>
|
||||
<div
|
||||
ref={presentationActionAnchorRef}
|
||||
className="flex items-center gap-2.5 rounded-full bg-white/70 dark:bg-black/60 backdrop-blur-xl border border-gray-200/60 dark:border-white/10 shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] px-2.5 py-2"
|
||||
className="flex items-center gap-2.5 rounded-full bg-white/70 dark:bg-black/60 border border-neutral-200/60 dark:border-white/10 shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)] px-2.5 py-2"
|
||||
>
|
||||
{/* Speaking / discussion-requesting agent avatar — shows when
|
||||
a student agent is actively speaking OR a discussion request
|
||||
@ -995,7 +1000,7 @@ export function Roundtable({
|
||||
>
|
||||
<div className="relative w-10 h-10 rounded-full flex items-center justify-center">
|
||||
<div className="absolute inset-0 rounded-full border-2 border-blue-500 shadow-[0_0_6px_rgba(59,130,246,0.3)] transition-all duration-300" />
|
||||
<div className="w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-800 overflow-hidden relative z-10 text-lg">
|
||||
<div className="w-8 h-8 rounded-full bg-neutral-200 dark:bg-neutral-800 overflow-hidden relative z-10 text-lg">
|
||||
<AvatarDisplay
|
||||
src={
|
||||
(speakingStudent || presentationDiscussionParticipant)?.avatar ||
|
||||
@ -1023,7 +1028,7 @@ export function Roundtable({
|
||||
delay: i * 0.12,
|
||||
ease: 'easeInOut',
|
||||
}}
|
||||
className="w-[3px] h-[3px] rounded-full bg-purple-400"
|
||||
className="w-[3px] h-[3px] rounded-full bg-neutral-400"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@ -1044,10 +1049,10 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'w-8 h-8 rounded-full flex items-center justify-center transition-all active:scale-95',
|
||||
!asrEnabled
|
||||
? 'text-gray-500 cursor-not-allowed'
|
||||
? 'text-neutral-500 cursor-not-allowed'
|
||||
: isVoiceOpen
|
||||
? 'bg-purple-600 text-white'
|
||||
: 'text-gray-500 dark:text-gray-300 hover:text-gray-700 dark:hover:text-white hover:bg-gray-200/50 dark:hover:bg-white/10',
|
||||
? 'bg-neutral-600 text-white'
|
||||
: 'text-neutral-500 dark:text-neutral-300 hover:text-neutral-700 dark:hover:text-white hover:bg-neutral-200/50 dark:hover:bg-white/10',
|
||||
)}
|
||||
>
|
||||
{asrEnabled ? <Mic className="w-4 h-4" /> : <MicOff className="w-4 h-4" />}
|
||||
@ -1061,8 +1066,8 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'w-8 h-8 rounded-full flex items-center justify-center transition-all active:scale-95',
|
||||
isInputOpen
|
||||
? 'bg-purple-600 text-white'
|
||||
: 'text-gray-500 dark:text-gray-300 hover:text-gray-700 dark:hover:text-white hover:bg-gray-200/50 dark:hover:bg-white/10',
|
||||
? 'bg-neutral-600 text-white'
|
||||
: 'text-neutral-500 dark:text-neutral-300 hover:text-neutral-700 dark:hover:text-white hover:bg-neutral-200/50 dark:hover:bg-white/10',
|
||||
)}
|
||||
>
|
||||
<MessageSquare className="w-4 h-4" />
|
||||
@ -1093,11 +1098,11 @@ export function Roundtable({
|
||||
isCueUser
|
||||
? 'border-amber-500 shadow-[0_0_10px_rgba(245,158,11,0.4)] animate-pulse'
|
||||
: activeRole === 'user' || isInputOpen
|
||||
? 'border-purple-500 shadow-[0_0_6px_rgba(168,85,247,0.3)]'
|
||||
: 'border-gray-300/40 dark:border-white/20 group-hover:border-purple-400/50',
|
||||
? 'border-neutral-500 shadow-[0_0_6px_rgba(0,0,0,0.08)]'
|
||||
: 'border-neutral-300/40 dark:border-white/20 group-hover:border-neutral-400/50',
|
||||
)}
|
||||
/>
|
||||
<div className="w-8 h-8 rounded-full bg-gray-200 dark:bg-gray-800 overflow-hidden relative z-10 text-lg">
|
||||
<div className="w-8 h-8 rounded-full bg-neutral-200 dark:bg-neutral-800 overflow-hidden relative z-10 text-lg">
|
||||
<AvatarDisplay src={userAvatar} alt={t('roundtable.you')} />
|
||||
</div>
|
||||
</div>
|
||||
@ -1135,13 +1140,152 @@ export function Roundtable({
|
||||
);
|
||||
}
|
||||
|
||||
if (layout === 'sidebar') {
|
||||
return (
|
||||
<>
|
||||
{toolbarContainer && createPortal(toolbar, toolbarContainer)}
|
||||
<section aria-label="课堂互动" className="flex flex-col gap-3 bg-background p-4">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<img
|
||||
src={teacherAvatar}
|
||||
alt=""
|
||||
className="size-8 rounded-full border border-border"
|
||||
/>
|
||||
<div className="min-w-0">
|
||||
<p className="truncate text-sm font-semibold">{bubbleName || teacherName}</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{isCueUser ? t('roundtable.yourTurn') : '课堂互动'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex -space-x-2">
|
||||
{initialParticipants
|
||||
?.filter((participant) => participant.role !== 'teacher')
|
||||
.slice(0, 3)
|
||||
.map((participant) => (
|
||||
<img
|
||||
key={participant.id}
|
||||
src={participant.avatar}
|
||||
alt={participant.name}
|
||||
title={participant.name}
|
||||
className="size-6 rounded-full border-2 border-background"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{discussionRequest && (
|
||||
<div className="rounded-lg border border-orange-200 bg-orange-50 p-3 text-sm text-neutral-900 dark:border-orange-900 dark:bg-orange-950 dark:text-neutral-100">
|
||||
<p>{discussionRequest.topic}</p>
|
||||
<div className="mt-2 flex gap-4">
|
||||
<button
|
||||
onClick={() => onDiscussionStart?.(discussionRequest)}
|
||||
className="font-semibold"
|
||||
>
|
||||
参与讨论
|
||||
</button>
|
||||
<button onClick={() => onDiscussionSkip?.()} className="text-muted-foreground">
|
||||
跳过
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
ref={bubbleScrollRef}
|
||||
className="max-h-32 min-h-12 overflow-y-auto rounded-lg bg-muted/50 p-3 text-sm leading-6 whitespace-pre-wrap break-words"
|
||||
aria-live="off"
|
||||
>
|
||||
{thinkingState && !sourceText
|
||||
? t('roundtable.thinking')
|
||||
: sourceText || '有疑问随时提问,也可以结合当前课件一起讨论。'}
|
||||
</div>
|
||||
{(isInLiveFlow || isTopicPending) && (
|
||||
<div className="flex flex-wrap gap-3 text-xs">
|
||||
<button
|
||||
className="font-medium"
|
||||
onClick={() =>
|
||||
isTopicPending
|
||||
? onResumeTopic?.()
|
||||
: isDiscussionPaused
|
||||
? onDiscussionResume?.()
|
||||
: onDiscussionPause?.()
|
||||
}
|
||||
>
|
||||
{isTopicPending || isDiscussionPaused ? '继续讨论' : '暂停讨论'}
|
||||
</button>
|
||||
{showStopButton && (
|
||||
<button onClick={() => onStopDiscussion?.()} className="text-muted-foreground">
|
||||
结束讨论
|
||||
</button>
|
||||
)}
|
||||
{isSoftClosing && <button onClick={handleContinueSoftClosing}>继续提问</button>}
|
||||
</div>
|
||||
)}
|
||||
{elementReferencePill && <div className="min-w-0 overflow-hidden">{referencePill}</div>}
|
||||
<div className="rounded-lg border border-input bg-background p-2 focus-within:ring-2 focus-within:ring-ring">
|
||||
<textarea
|
||||
ref={nonPresentationInputRef}
|
||||
aria-label="向老师提问"
|
||||
value={inputValue}
|
||||
onChange={(event) => setInputValue(event.target.value)}
|
||||
onFocus={() => onInputActivate?.()}
|
||||
onBeforeInput={() => onUserInputActivity?.('text_input')}
|
||||
onCompositionStart={() => onUserInputActivity?.('composition_start')}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {
|
||||
event.preventDefault();
|
||||
handleSendMessage();
|
||||
}
|
||||
}}
|
||||
placeholder="输入你的问题,和老师一起讨论…"
|
||||
rows={2}
|
||||
className="max-h-28 min-h-14 w-full resize-none bg-transparent px-1 text-sm outline-none"
|
||||
/>
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
{asrEnabled ? (
|
||||
<button
|
||||
onClick={handleToggleVoice}
|
||||
disabled={isSendCooldown}
|
||||
aria-label={isVoiceOpen ? '停止录音' : '语音提问'}
|
||||
className="rounded-md p-2 hover:bg-muted"
|
||||
>
|
||||
{isProcessing ? (
|
||||
<Loader2 className="size-4 animate-spin" />
|
||||
) : isVoiceOpen ? (
|
||||
<MicOff className="size-4 text-orange-600" />
|
||||
) : (
|
||||
<Mic className="size-4" />
|
||||
)}
|
||||
</button>
|
||||
) : (
|
||||
<span className="text-[10px] text-muted-foreground">Shift + Enter 换行</span>
|
||||
)}
|
||||
<button
|
||||
onClick={handleSendMessage}
|
||||
disabled={isSendCooldown || !inputValue.trim()}
|
||||
className="flex items-center gap-1.5 rounded-md bg-primary px-3 py-2 text-xs text-primary-foreground disabled:opacity-40"
|
||||
>
|
||||
{isSendCooldown ? (
|
||||
<Loader2 className="size-3.5 animate-spin" />
|
||||
) : (
|
||||
<Send className="size-3.5" />
|
||||
)}
|
||||
发送
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'h-[192px] w-full flex flex-col relative z-10 transition-all duration-300',
|
||||
isPresenting && !controlsVisible
|
||||
? 'border-t border-transparent bg-transparent backdrop-blur-none'
|
||||
: 'border-t border-gray-100 dark:border-gray-800 bg-white/60 dark:bg-gray-800/60 backdrop-blur-md',
|
||||
: 'border-t border-neutral-100 dark:border-neutral-800 bg-white/60 dark:bg-neutral-800/60 ',
|
||||
)}
|
||||
>
|
||||
{/* ── Toolbar strip — merged from CanvasArea ── */}
|
||||
@ -1158,15 +1302,15 @@ export function Roundtable({
|
||||
{/* Left: Teacher identity */}
|
||||
<div
|
||||
className={cn(
|
||||
'w-[90px] shrink-0 flex flex-col border-r border-gray-100/50 dark:border-gray-700/50 bg-white/40 dark:bg-gray-900/40 overflow-visible relative transition-opacity duration-300',
|
||||
'w-[90px] shrink-0 flex flex-col border-r border-neutral-100/50 dark:border-neutral-700/50 bg-white/40 dark:bg-neutral-900/40 overflow-visible relative transition-opacity duration-300',
|
||||
isPresenting && !controlsVisible && 'opacity-0 pointer-events-none',
|
||||
)}
|
||||
>
|
||||
{/* Decorative Element (Top) */}
|
||||
<div className="absolute top-0 inset-x-0 h-16 bg-gradient-to-b from-purple-50/50 dark:from-purple-900/10 to-transparent pointer-events-none" />
|
||||
<div className="absolute top-0 inset-x-0 h-16 bg-gradient-to-b from-neutral-50/50 dark:from-neutral-900/10 to-transparent pointer-events-none" />
|
||||
<div className="absolute top-3 inset-x-0 flex flex-col items-center justify-center gap-1 opacity-10 pointer-events-none">
|
||||
<BookOpen size={20} className="text-purple-900 dark:text-purple-100" />
|
||||
<div className="w-8 h-0.5 bg-purple-900 dark:bg-purple-100 rounded-full" />
|
||||
<BookOpen size={20} className="text-neutral-900 dark:text-neutral-100" />
|
||||
<div className="w-8 h-0.5 bg-neutral-900 dark:bg-neutral-100 rounded-full" />
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
@ -1189,12 +1333,12 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'absolute inset-0 rounded-full border-2 transition-all duration-500',
|
||||
activeRole === 'teacher'
|
||||
? 'border-purple-500 dark:border-purple-400 shadow-[0_0_12px_rgba(168,85,247,0.4)]'
|
||||
: 'border-gray-200 dark:border-gray-700 group-hover:border-purple-300 dark:group-hover:border-purple-600',
|
||||
? 'border-neutral-500 dark:border-neutral-400 shadow-[0_0_12px_rgba(168,85,247,0.4)]'
|
||||
: 'border-neutral-200 dark:border-neutral-700 group-hover:border-neutral-300 dark:group-hover:border-neutral-600',
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="w-10 h-10 rounded-full bg-white dark:bg-gray-800 overflow-hidden relative z-10 shadow-sm border border-gray-50 dark:border-gray-700">
|
||||
<div className="w-10 h-10 rounded-full bg-white dark:bg-neutral-800 overflow-hidden relative z-10 shadow-sm border border-neutral-50 dark:border-neutral-700">
|
||||
<img
|
||||
src={teacherAvatar}
|
||||
alt={teacherName}
|
||||
@ -1203,7 +1347,7 @@ export function Roundtable({
|
||||
</div>
|
||||
|
||||
{activeRole === 'teacher' && (
|
||||
<div className="absolute -right-0.5 top-0.5 w-4 h-4 bg-green-500 dark:bg-green-400 rounded-full border-2 border-white dark:border-gray-800 flex items-center justify-center z-20">
|
||||
<div className="absolute -right-0.5 top-0.5 w-4 h-4 bg-green-500 dark:bg-green-400 rounded-full border-2 border-white dark:border-neutral-800 flex items-center justify-center z-20">
|
||||
<div className="w-1 h-1 bg-white rounded-full animate-pulse" />
|
||||
</div>
|
||||
)}
|
||||
@ -1211,10 +1355,10 @@ export function Roundtable({
|
||||
|
||||
<span
|
||||
className={cn(
|
||||
'max-w-[80px] truncate px-2 py-0.5 rounded-full text-[10px] font-bold tracking-wider uppercase border shadow-sm transition-all duration-300 bg-white/90 dark:bg-gray-800/90',
|
||||
'max-w-[80px] truncate px-2 py-0.5 rounded-full text-[10px] font-bold tracking-wider uppercase border shadow-sm transition-all duration-300 bg-white/90 dark:bg-neutral-800/90',
|
||||
activeRole === 'teacher' && !speakingStudent
|
||||
? 'text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-700'
|
||||
: 'text-gray-400 dark:text-gray-500 border-gray-100 dark:border-gray-700 group-hover:text-purple-500 dark:group-hover:text-purple-400 group-hover:border-purple-200 dark:group-hover:border-purple-600',
|
||||
? 'text-neutral-600 dark:text-neutral-400 border-neutral-200 dark:border-neutral-700'
|
||||
: 'text-neutral-400 dark:text-neutral-500 border-neutral-100 dark:border-neutral-700 group-hover:text-neutral-500 dark:group-hover:text-neutral-400 group-hover:border-neutral-200 dark:group-hover:border-neutral-600',
|
||||
)}
|
||||
>
|
||||
{teacherName}
|
||||
@ -1231,7 +1375,7 @@ export function Roundtable({
|
||||
return (
|
||||
<>
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-full overflow-hidden shrink-0 bg-gray-100 dark:bg-gray-800">
|
||||
<div className="w-8 h-8 rounded-full overflow-hidden shrink-0 bg-neutral-100 dark:bg-neutral-800">
|
||||
<img
|
||||
src={teacherAvatar}
|
||||
alt={teacherName}
|
||||
@ -1299,9 +1443,9 @@ export function Roundtable({
|
||||
times: [0, 0.15, 0.7, 1],
|
||||
ease: 'easeOut',
|
||||
}}
|
||||
className="absolute top-1 left-1/2 -translate-x-1/2 z-50 bg-gray-800/80 backdrop-blur-md text-white px-3.5 py-1.5 rounded-full text-xs font-medium pointer-events-none"
|
||||
className="absolute top-1 left-1/2 -translate-x-1/2 z-50 bg-neutral-800/80 text-white px-3.5 py-1.5 rounded-full text-xs font-medium pointer-events-none"
|
||||
>
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-gray-400 inline-block mr-1.5" />
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-neutral-400 inline-block mr-1.5" />
|
||||
{endFlashSessionType === 'discussion'
|
||||
? t('roundtable.discussionEnded')
|
||||
: t('roundtable.qaEnded')}
|
||||
@ -1318,7 +1462,7 @@ export function Roundtable({
|
||||
if (isRecording || isProcessing) cancelRecording();
|
||||
}
|
||||
}}
|
||||
className="relative w-full h-full rounded-[2.5rem] bg-gradient-to-b from-white/40 to-white/80 dark:from-gray-800/40 dark:to-gray-800/80 backdrop-blur-xl border border-white/50 dark:border-gray-700/50 shadow-[0_20px_60px_-15px_rgba(0,0,0,0.05),inset_0_1px_0_0_rgba(255,255,255,0.9)] dark:shadow-[0_20px_60px_-15px_rgba(0,0,0,0.3)] flex flex-col justify-center px-6 overflow-hidden group transition-all duration-700 cursor-default"
|
||||
className="relative w-full h-full rounded-xl bg-card border border-border flex flex-col justify-center px-6 overflow-hidden group transition-all duration-700 cursor-default"
|
||||
>
|
||||
{elementReferencePill && (
|
||||
<div className="absolute left-1/2 top-2 z-30 -translate-x-1/2">{referencePill}</div>
|
||||
@ -1342,7 +1486,7 @@ export function Roundtable({
|
||||
>
|
||||
<div
|
||||
data-testid="roundtable-non-presentation-input-panel"
|
||||
className="relative w-fit max-w-[85%] sm:max-w-[65%] min-w-[200px] sm:min-w-[300px] bg-white/90 dark:bg-gray-800/90 backdrop-blur-md p-2 pr-2 rounded-2xl rounded-br-none shadow-2xl border border-purple-200 dark:border-purple-700 flex items-end gap-2 ring-1 ring-purple-100/50 dark:ring-purple-800/50"
|
||||
className="relative w-fit max-w-[85%] sm:max-w-[65%] min-w-[200px] sm:min-w-[300px] bg-white/90 dark:bg-neutral-800/90 p-2 pr-2 rounded-2xl rounded-br-none shadow-2xl border border-neutral-200 dark:border-neutral-700 flex items-end gap-2 ring-1 ring-neutral-100/50 dark:ring-neutral-800/50"
|
||||
>
|
||||
<div className="pl-4 flex-1 py-1 min-w-0">
|
||||
<textarea
|
||||
@ -1360,7 +1504,7 @@ export function Roundtable({
|
||||
placeholder={t('roundtable.inputPlaceholder')}
|
||||
autoFocus
|
||||
rows={1}
|
||||
className="w-full resize-none overflow-y-auto bg-transparent border-none focus:ring-0 focus:outline-none outline-none shadow-none ring-0 text-gray-700 dark:text-gray-200 text-sm placeholder:text-gray-400 dark:placeholder:text-gray-500 min-h-[40px] max-h-[100px]"
|
||||
className="w-full resize-none overflow-y-auto bg-transparent border-none focus:ring-0 focus:outline-none outline-none shadow-none ring-0 text-neutral-700 dark:text-neutral-200 text-sm placeholder:text-neutral-400 dark:placeholder:text-neutral-500 min-h-[40px] max-h-[100px]"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
@ -1369,8 +1513,8 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'p-2.5 text-white rounded-xl transition shadow-md mb-0.5 shrink-0',
|
||||
isSendCooldown
|
||||
? 'bg-gray-400 dark:bg-gray-600 cursor-not-allowed shadow-gray-200 dark:shadow-gray-900/50'
|
||||
: 'bg-purple-600 hover:bg-purple-700 dark:bg-purple-500 dark:hover:bg-purple-600 shadow-purple-200 dark:shadow-purple-900/50',
|
||||
? 'bg-neutral-400 dark:bg-neutral-600 cursor-not-allowed shadow-neutral-200 dark:shadow-neutral-900/50'
|
||||
: 'bg-neutral-600 hover:bg-neutral-700 dark:bg-neutral-500 dark:hover:bg-neutral-600 shadow-neutral-200 dark:shadow-neutral-900/50',
|
||||
)}
|
||||
>
|
||||
{isSendCooldown ? (
|
||||
@ -1399,13 +1543,13 @@ export function Roundtable({
|
||||
className="absolute right-4 top-1/2 -translate-y-1/2 z-30 flex items-center gap-4 pr-2 pointer-events-none"
|
||||
>
|
||||
<div className="flex flex-col-reverse items-end gap-1 mr-[-10px] relative z-20">
|
||||
<div className="flex items-center gap-0.5 h-8 px-2 py-1.5 bg-white/80 dark:bg-gray-800/80 backdrop-blur-md rounded-xl border border-purple-100 dark:border-purple-800 shadow-sm">
|
||||
<VoiceWaveformBars barClassName="bg-gradient-to-t from-purple-500 to-indigo-600 dark:from-purple-400 dark:to-indigo-500" />
|
||||
<div className="flex items-center gap-0.5 h-8 px-2 py-1.5 bg-white/80 dark:bg-neutral-800/80 rounded-xl border border-neutral-100 dark:border-neutral-800 shadow-sm">
|
||||
<VoiceWaveformBars barClassName="bg-gradient-to-t from-neutral-500 to-neutral-600 dark:from-neutral-400 dark:to-neutral-500" />
|
||||
</div>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, x: 10 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
className="text-[10px] font-bold tracking-widest text-purple-600 dark:text-purple-400 uppercase bg-white/90 dark:bg-gray-800/90 backdrop-blur-sm px-2 py-0.5 rounded-full shadow-sm border border-purple-100/50 dark:border-purple-800/50 mr-1"
|
||||
className="text-[10px] font-bold tracking-widest text-neutral-600 dark:text-neutral-400 uppercase bg-white/90 dark:bg-neutral-800/90 backdrop-blur-sm px-2 py-0.5 rounded-full shadow-sm border border-neutral-100/50 dark:border-neutral-800/50 mr-1"
|
||||
>
|
||||
{isProcessing ? t('roundtable.processing') : t('roundtable.listening')}
|
||||
</motion.div>
|
||||
@ -1415,12 +1559,12 @@ export function Roundtable({
|
||||
className="pointer-events-auto relative group cursor-pointer"
|
||||
onClick={handleToggleVoice}
|
||||
>
|
||||
<div className="relative w-16 h-16 rounded-full bg-gradient-to-br from-purple-600 to-indigo-700 dark:from-purple-500 dark:to-indigo-600 shadow-[0_4px_20px_rgba(147,51,234,0.3)] flex items-center justify-center z-20 group-hover:scale-105 transition-transform duration-300 border border-white/20 dark:border-white/10">
|
||||
<div className="relative w-16 h-16 rounded-full bg-gradient-to-br from-neutral-600 to-neutral-700 dark:from-neutral-500 dark:to-neutral-600 shadow-[0_4px_20px_rgba(0,0,0,0.08)] flex items-center justify-center z-20 group-hover:scale-105 transition-transform duration-300 border border-white/20 dark:border-white/10">
|
||||
<Mic className="w-6 h-6 text-white" />
|
||||
</div>
|
||||
<div className="absolute inset-0 rounded-full border-2 border-purple-500 dark:border-purple-400 opacity-40 animate-[ping_2s_ease-in-out_infinite] z-10" />
|
||||
<div className="absolute inset-0 rounded-full border border-indigo-400 dark:border-indigo-300 opacity-20 animate-[ping_3s_ease-in-out_infinite_0.5s] z-10" />
|
||||
<div className="absolute inset-0 bg-purple-600 dark:bg-purple-500 blur-2xl opacity-20 group-hover:opacity-40 transition-opacity z-0" />
|
||||
<div className="absolute inset-0 rounded-full border-2 border-neutral-500 dark:border-neutral-400 opacity-40 animate-[ping_2s_ease-in-out_infinite] z-10" />
|
||||
<div className="absolute inset-0 rounded-full border border-neutral-400 dark:border-neutral-300 opacity-20 animate-[ping_3s_ease-in-out_infinite_0.5s] z-10" />
|
||||
<div className="absolute inset-0 bg-neutral-600 dark:bg-neutral-500 blur-2xl opacity-20 group-hover:opacity-40 transition-opacity z-0" />
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
@ -1433,7 +1577,7 @@ export function Roundtable({
|
||||
initial={{ opacity: 0, scale: 0.9 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.9 }}
|
||||
className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-20 flex items-center gap-2 px-4 py-2 bg-white/90 dark:bg-gray-800/90 backdrop-blur-md rounded-full shadow-sm border border-gray-100 dark:border-gray-700"
|
||||
className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-20 flex items-center gap-2 px-4 py-2 bg-white/90 dark:bg-neutral-800/90 rounded-full shadow-sm border border-neutral-100 dark:border-neutral-700"
|
||||
>
|
||||
<div className="flex gap-1">
|
||||
<motion.div
|
||||
@ -1443,7 +1587,7 @@ export function Roundtable({
|
||||
duration: 1.2,
|
||||
delay: 0,
|
||||
}}
|
||||
className="w-1.5 h-1.5 rounded-full bg-purple-500"
|
||||
className="w-1.5 h-1.5 rounded-full bg-neutral-500"
|
||||
/>
|
||||
<motion.div
|
||||
animate={{ opacity: [0.3, 1, 0.3] }}
|
||||
@ -1452,7 +1596,7 @@ export function Roundtable({
|
||||
duration: 1.2,
|
||||
delay: 0.2,
|
||||
}}
|
||||
className="w-1.5 h-1.5 rounded-full bg-purple-500"
|
||||
className="w-1.5 h-1.5 rounded-full bg-neutral-500"
|
||||
/>
|
||||
<motion.div
|
||||
animate={{ opacity: [0.3, 1, 0.3] }}
|
||||
@ -1461,10 +1605,10 @@ export function Roundtable({
|
||||
duration: 1.2,
|
||||
delay: 0.4,
|
||||
}}
|
||||
className="w-1.5 h-1.5 rounded-full bg-purple-500"
|
||||
className="w-1.5 h-1.5 rounded-full bg-neutral-500"
|
||||
/>
|
||||
</div>
|
||||
<span className="text-[10px] text-gray-400 dark:text-gray-500 font-medium">
|
||||
<span className="text-[10px] text-neutral-400 dark:text-neutral-500 font-medium">
|
||||
{t('roundtable.thinking')}
|
||||
</span>
|
||||
</motion.div>
|
||||
@ -1489,7 +1633,7 @@ export function Roundtable({
|
||||
'absolute w-24 h-24 rounded-full blur-2xl',
|
||||
asrEnabled
|
||||
? 'bg-amber-400/[0.08] dark:bg-amber-500/[0.06]'
|
||||
: 'bg-purple-400/[0.08] dark:bg-purple-500/[0.06]',
|
||||
: 'bg-neutral-400/[0.08] dark:bg-neutral-500/[0.06]',
|
||||
)}
|
||||
/>
|
||||
|
||||
@ -1505,7 +1649,7 @@ export function Roundtable({
|
||||
'absolute w-11 h-11 rounded-full border',
|
||||
asrEnabled
|
||||
? 'border-amber-400/50 dark:border-amber-500/35'
|
||||
: 'border-purple-400/50 dark:border-purple-500/35',
|
||||
: 'border-neutral-400/50 dark:border-neutral-500/35',
|
||||
)}
|
||||
/>
|
||||
{/* Expanding ripple 2 */}
|
||||
@ -1521,7 +1665,7 @@ export function Roundtable({
|
||||
'absolute w-11 h-11 rounded-full border',
|
||||
asrEnabled
|
||||
? 'border-amber-300/40 dark:border-amber-400/25'
|
||||
: 'border-purple-300/40 dark:border-purple-400/25',
|
||||
: 'border-neutral-300/40 dark:border-neutral-400/25',
|
||||
)}
|
||||
/>
|
||||
|
||||
@ -1542,7 +1686,7 @@ export function Roundtable({
|
||||
'relative w-11 h-11 rounded-full flex items-center justify-center shadow-lg cursor-pointer hover:shadow-xl active:scale-95 z-10 bg-gradient-to-br',
|
||||
asrEnabled
|
||||
? 'from-amber-400 to-orange-500 dark:from-amber-500 dark:to-orange-600 shadow-amber-400/30 dark:shadow-amber-600/20 hover:shadow-amber-400/40 dark:hover:shadow-amber-600/30'
|
||||
: 'from-purple-400 to-indigo-500 dark:from-purple-500 dark:to-indigo-600 shadow-purple-400/30 dark:shadow-purple-600/20 hover:shadow-purple-400/40 dark:hover:shadow-purple-600/30',
|
||||
: 'from-neutral-400 to-neutral-500 dark:from-neutral-500 dark:to-neutral-600 shadow-neutral-400/30 dark:shadow-neutral-600/20 hover:shadow-neutral-400/40 dark:hover:shadow-neutral-600/30',
|
||||
)}
|
||||
>
|
||||
{asrEnabled ? (
|
||||
@ -1588,7 +1732,7 @@ export function Roundtable({
|
||||
delay: i * 0.12,
|
||||
ease: 'easeInOut',
|
||||
}}
|
||||
className="w-[2.5px] h-full origin-center rounded-full bg-purple-400/60 dark:bg-purple-500/50"
|
||||
className="w-[2.5px] h-full origin-center rounded-full bg-neutral-400/60 dark:bg-neutral-500/50"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@ -1606,7 +1750,7 @@ export function Roundtable({
|
||||
'text-[10px] font-medium tracking-wider',
|
||||
asrEnabled
|
||||
? 'text-amber-600/70 dark:text-amber-400/60'
|
||||
: 'text-purple-600/70 dark:text-purple-400/60',
|
||||
: 'text-neutral-600/70 dark:text-neutral-400/60',
|
||||
)}
|
||||
>
|
||||
{t('roundtable.yourTurn')}
|
||||
@ -1662,14 +1806,14 @@ export function Roundtable({
|
||||
'relative px-4 pt-2 pb-3 rounded-2xl text-[15px] leading-relaxed transition-all border w-[min(420px,calc(100%-3rem))] group/bubble flex flex-col max-h-[110px]',
|
||||
bubbleRole === 'teacher' ? 'pl-4 pr-10' : 'pl-4 pr-10',
|
||||
bubbleRole === 'user'
|
||||
? 'bg-purple-600/95 dark:bg-purple-500/95 backdrop-blur-sm border-purple-400/40 dark:border-purple-300/40 text-white rounded-br-sm shadow-md shadow-purple-300/30 dark:shadow-purple-800/30'
|
||||
? 'bg-neutral-600/95 dark:bg-neutral-500/95 backdrop-blur-sm border-neutral-400/40 dark:border-neutral-300/40 text-white rounded-br-sm shadow-md shadow-neutral-300/30 dark:shadow-neutral-800/30'
|
||||
: bubbleRole === 'agent'
|
||||
? cn(
|
||||
'bg-blue-50/95 dark:bg-blue-950/60 backdrop-blur-sm border-blue-200/60 dark:border-blue-800/60 text-gray-700 dark:text-gray-200 rounded-br-sm shadow-sm',
|
||||
'bg-blue-50/95 dark:bg-blue-950/60 backdrop-blur-sm border-blue-200/60 dark:border-blue-800/60 text-neutral-700 dark:text-neutral-200 rounded-br-sm shadow-sm',
|
||||
(isInLiveFlow || isTopicPending) &&
|
||||
'hover:shadow-md cursor-pointer',
|
||||
)
|
||||
: 'bg-white dark:bg-gray-800 border-gray-100 dark:border-gray-700 text-gray-700 dark:text-gray-200 rounded-bl-sm shadow-sm hover:shadow-md cursor-pointer',
|
||||
: 'bg-white dark:bg-neutral-800 border-neutral-100 dark:border-neutral-700 text-neutral-700 dark:text-neutral-200 rounded-bl-sm shadow-sm hover:shadow-md cursor-pointer',
|
||||
)}
|
||||
>
|
||||
{bubbleRole &&
|
||||
@ -1692,10 +1836,10 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'w-6 h-6 rounded-full overflow-hidden border-2 shadow-sm',
|
||||
bubbleRole === 'user'
|
||||
? 'border-purple-400 dark:border-purple-500'
|
||||
? 'border-neutral-400 dark:border-neutral-500'
|
||||
: bubbleRole === 'agent'
|
||||
? 'border-blue-300 dark:border-blue-600'
|
||||
: 'border-purple-200 dark:border-purple-700',
|
||||
: 'border-neutral-200 dark:border-neutral-700',
|
||||
)}
|
||||
>
|
||||
<AvatarDisplay src={bubbleAvatar} alt={bubbleName} />
|
||||
@ -1708,7 +1852,7 @@ export function Roundtable({
|
||||
{/* Agent name + audio indicator header */}
|
||||
{bubbleRole !== 'user' && bubbleName && (
|
||||
<div className="flex items-center gap-1 mb-0.5">
|
||||
<span className="text-[10px] font-semibold text-gray-400 dark:text-gray-500 truncate">
|
||||
<span className="text-[10px] font-semibold text-neutral-400 dark:text-neutral-500 truncate">
|
||||
{bubbleName}
|
||||
</span>
|
||||
{(() => {
|
||||
@ -1722,7 +1866,7 @@ export function Roundtable({
|
||||
);
|
||||
if (aiState === 'playing')
|
||||
return (
|
||||
<Volume2 className="w-3 h-3 text-gray-400 dark:text-gray-500" />
|
||||
<Volume2 className="w-3 h-3 text-neutral-400 dark:text-neutral-500" />
|
||||
);
|
||||
return null;
|
||||
})()}
|
||||
@ -1741,7 +1885,7 @@ export function Roundtable({
|
||||
'w-1.5 h-1.5 rounded-full',
|
||||
isAgentLoading
|
||||
? 'bg-blue-400 dark:bg-blue-500'
|
||||
: 'bg-purple-400 dark:bg-purple-500',
|
||||
: 'bg-neutral-400 dark:bg-neutral-500',
|
||||
)}
|
||||
/>
|
||||
<motion.div
|
||||
@ -1755,7 +1899,7 @@ export function Roundtable({
|
||||
'w-1.5 h-1.5 rounded-full',
|
||||
isAgentLoading
|
||||
? 'bg-blue-400 dark:bg-blue-500'
|
||||
: 'bg-purple-400 dark:bg-purple-500',
|
||||
: 'bg-neutral-400 dark:bg-neutral-500',
|
||||
)}
|
||||
/>
|
||||
<motion.div
|
||||
@ -1769,7 +1913,7 @@ export function Roundtable({
|
||||
'w-1.5 h-1.5 rounded-full',
|
||||
isAgentLoading
|
||||
? 'bg-blue-400 dark:bg-blue-500'
|
||||
: 'bg-purple-400 dark:bg-purple-500',
|
||||
: 'bg-neutral-400 dark:bg-neutral-500',
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
@ -1789,32 +1933,32 @@ export function Roundtable({
|
||||
(() => {
|
||||
const btnState = playbackView?.buttonState ?? 'none';
|
||||
const barsColor =
|
||||
bubbleRole === 'agent' ? 'bg-blue-500' : 'bg-purple-500';
|
||||
bubbleRole === 'agent' ? 'bg-blue-500' : 'bg-neutral-500';
|
||||
|
||||
if (btnState === 'none') return null;
|
||||
|
||||
if (btnState === 'play') {
|
||||
return (
|
||||
<div className="absolute right-2.5 bottom-2.5 p-1.5 rounded-full bg-gray-50/80 dark:bg-gray-700/80 hover:bg-purple-100 dark:hover:bg-purple-900/50 group-hover/bubble:bg-purple-100 dark:group-hover/bubble:bg-purple-900/50 transition-all duration-300 cursor-pointer">
|
||||
<Play className="w-3.5 h-3.5 text-gray-400 dark:text-gray-500 hover:text-purple-600 dark:hover:text-purple-400 group-hover/bubble:text-purple-600 dark:group-hover/bubble:text-purple-400 ml-0.5" />
|
||||
<div className="absolute right-2.5 bottom-2.5 p-1.5 rounded-full bg-neutral-50/80 dark:bg-neutral-700/80 hover:bg-neutral-100 dark:hover:bg-neutral-900/50 group-hover/bubble:bg-neutral-100 dark:group-hover/bubble:bg-neutral-900/50 transition-all duration-300 cursor-pointer">
|
||||
<Play className="w-3.5 h-3.5 text-neutral-400 dark:text-neutral-500 hover:text-neutral-600 dark:hover:text-neutral-400 group-hover/bubble:text-neutral-600 dark:group-hover/bubble:text-neutral-400 ml-0.5" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (btnState === 'restart') {
|
||||
return (
|
||||
<div className="absolute right-2.5 bottom-2.5 p-1.5 rounded-full bg-gray-50/80 dark:bg-gray-700/80 hover:bg-purple-100 dark:hover:bg-purple-900/50 group-hover/bubble:bg-purple-100 dark:group-hover/bubble:bg-purple-900/50 transition-all duration-300 cursor-pointer">
|
||||
<Repeat className="w-3.5 h-3.5 text-gray-400 dark:text-gray-500 hover:text-purple-600 dark:hover:text-purple-400 group-hover/bubble:text-purple-600 dark:group-hover/bubble:text-purple-400" />
|
||||
<div className="absolute right-2.5 bottom-2.5 p-1.5 rounded-full bg-neutral-50/80 dark:bg-neutral-700/80 hover:bg-neutral-100 dark:hover:bg-neutral-900/50 group-hover/bubble:bg-neutral-100 dark:group-hover/bubble:bg-neutral-900/50 transition-all duration-300 cursor-pointer">
|
||||
<Repeat className="w-3.5 h-3.5 text-neutral-400 dark:text-neutral-500 hover:text-neutral-600 dark:hover:text-neutral-400 group-hover/bubble:text-neutral-600 dark:group-hover/bubble:text-neutral-400" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// btnState === 'bars'
|
||||
return (
|
||||
<div className="absolute right-2.5 bottom-2.5 p-1.5 rounded-full bg-gray-50/80 dark:bg-gray-700/80 group-hover/bubble:bg-purple-100 dark:group-hover/bubble:bg-purple-900/50 transition-all duration-300">
|
||||
<div className="absolute right-2.5 bottom-2.5 p-1.5 rounded-full bg-neutral-50/80 dark:bg-neutral-700/80 group-hover/bubble:bg-neutral-100 dark:group-hover/bubble:bg-neutral-900/50 transition-all duration-300">
|
||||
{isDiscussionPaused ? (
|
||||
/* Paused: static Play icon */
|
||||
<Play className="w-3.5 h-3.5 text-amber-500 dark:text-amber-400 group-hover/bubble:text-purple-600 dark:group-hover/bubble:text-purple-400 ml-0.5" />
|
||||
<Play className="w-3.5 h-3.5 text-amber-500 dark:text-amber-400 group-hover/bubble:text-neutral-600 dark:group-hover/bubble:text-neutral-400 ml-0.5" />
|
||||
) : (
|
||||
<>
|
||||
{/* Breathing bars — visible by default, hidden on hover */}
|
||||
@ -1845,7 +1989,7 @@ export function Roundtable({
|
||||
/>
|
||||
</div>
|
||||
{/* Pause icon on hover */}
|
||||
<Pause className="w-3.5 h-3.5 text-purple-600 dark:text-purple-400 hidden group-hover/bubble:block" />
|
||||
<Pause className="w-3.5 h-3.5 text-neutral-600 dark:text-neutral-400 hidden group-hover/bubble:block" />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
@ -1862,7 +2006,7 @@ export function Roundtable({
|
||||
{/* Right: Participants area */}
|
||||
<div
|
||||
className={cn(
|
||||
'w-[140px] shrink-0 flex flex-col py-3 border-l border-gray-100/50 dark:border-gray-700/50 bg-gray-50/30 dark:bg-gray-900/30 overflow-visible transition-opacity duration-300',
|
||||
'w-[140px] shrink-0 flex flex-col py-3 border-l border-neutral-100/50 dark:border-neutral-700/50 bg-neutral-50/30 dark:bg-neutral-900/30 overflow-visible transition-opacity duration-300',
|
||||
isPresenting && !controlsVisible && 'opacity-0 pointer-events-none',
|
||||
)}
|
||||
>
|
||||
@ -1876,9 +2020,9 @@ export function Roundtable({
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}}
|
||||
className="absolute left-0 top-0 bottom-0 w-5 z-10 flex items-center justify-center bg-gradient-to-r from-gray-50/90 dark:from-gray-900/90 to-transparent opacity-0 group-hover/scroll:opacity-100 transition-opacity cursor-pointer"
|
||||
className="absolute left-0 top-0 bottom-0 w-5 z-10 flex items-center justify-center bg-gradient-to-r from-neutral-50/90 dark:from-neutral-900/90 to-transparent opacity-0 group-hover/scroll:opacity-100 transition-opacity cursor-pointer"
|
||||
>
|
||||
<ChevronLeft className="w-3.5 h-3.5 text-gray-400" />
|
||||
<ChevronLeft className="w-3.5 h-3.5 text-neutral-400" />
|
||||
</button>
|
||||
|
||||
<div
|
||||
@ -1954,11 +2098,11 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'absolute inset-0 rounded-full border-2 transition-all duration-300',
|
||||
isSpeaking
|
||||
? 'border-purple-500 dark:border-purple-400 shadow-[0_0_8px_rgba(168,85,247,0.4)]'
|
||||
: 'border-white dark:border-gray-700',
|
||||
? 'border-neutral-500 dark:border-neutral-400 shadow-[0_0_8px_rgba(168,85,247,0.4)]'
|
||||
: 'border-white dark:border-neutral-700',
|
||||
)}
|
||||
/>
|
||||
<div className="absolute inset-0.5 rounded-full bg-gray-100 dark:bg-gray-800 overflow-hidden">
|
||||
<div className="absolute inset-0.5 rounded-full bg-neutral-100 dark:bg-neutral-800 overflow-hidden">
|
||||
<img
|
||||
src={student.avatar}
|
||||
alt={student.name}
|
||||
@ -1967,13 +2111,13 @@ export function Roundtable({
|
||||
</div>
|
||||
{/* Speaking indicator */}
|
||||
{isSpeaking && (
|
||||
<div className="absolute -right-0.5 -top-0.5 w-3 h-3 bg-green-500 rounded-full border border-white dark:border-gray-800 z-20 flex items-center justify-center">
|
||||
<div className="absolute -right-0.5 -top-0.5 w-3 h-3 bg-green-500 rounded-full border border-white dark:border-neutral-800 z-20 flex items-center justify-center">
|
||||
<div className="w-1 h-1 bg-white rounded-full animate-pulse" />
|
||||
</div>
|
||||
)}
|
||||
{/* Loading indicator (Issue 5) */}
|
||||
{isThinkingAgent && (
|
||||
<div className="absolute inset-0 rounded-full border-2 border-purple-400 border-t-transparent animate-spin z-20" />
|
||||
<div className="absolute inset-0 rounded-full border-2 border-neutral-400 border-t-transparent animate-spin z-20" />
|
||||
)}
|
||||
</div>
|
||||
</HoverCardTrigger>
|
||||
@ -1983,7 +2127,7 @@ export function Roundtable({
|
||||
className="w-64 p-3 max-h-[300px] overflow-y-auto"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-full overflow-hidden shrink-0 bg-gray-100 dark:bg-gray-800">
|
||||
<div className="w-8 h-8 rounded-full overflow-hidden shrink-0 bg-neutral-100 dark:bg-neutral-800">
|
||||
<img
|
||||
src={student.avatar}
|
||||
alt={student.name}
|
||||
@ -2025,9 +2169,9 @@ export function Roundtable({
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}}
|
||||
className="absolute right-0 top-0 bottom-0 w-5 z-10 flex items-center justify-center bg-gradient-to-l from-gray-50/90 dark:from-gray-900/90 to-transparent opacity-0 group-hover/scroll:opacity-100 transition-opacity cursor-pointer"
|
||||
className="absolute right-0 top-0 bottom-0 w-5 z-10 flex items-center justify-center bg-gradient-to-l from-neutral-50/90 dark:from-neutral-900/90 to-transparent opacity-0 group-hover/scroll:opacity-100 transition-opacity cursor-pointer"
|
||||
>
|
||||
<ChevronRight className="w-3.5 h-3.5 text-gray-400" />
|
||||
<ChevronRight className="w-3.5 h-3.5 text-neutral-400" />
|
||||
</button>
|
||||
|
||||
{/* ProactiveCard for student/non-teacher agents — rendered via portal */}
|
||||
@ -2058,7 +2202,7 @@ export function Roundtable({
|
||||
</div>
|
||||
|
||||
{/* Divider */}
|
||||
<div className="mx-auto my-1.5 w-8 h-px bg-gray-200 dark:bg-gray-700 opacity-50 shrink-0" />
|
||||
<div className="mx-auto my-1.5 w-8 h-px bg-neutral-200 dark:bg-neutral-700 opacity-50 shrink-0" />
|
||||
|
||||
{/* User avatar + interaction buttons */}
|
||||
<div className="flex-1 flex items-center justify-center gap-3 px-2 min-h-0">
|
||||
@ -2080,7 +2224,7 @@ export function Roundtable({
|
||||
delay: i * 0.12,
|
||||
ease: 'easeInOut',
|
||||
}}
|
||||
className="w-[4px] h-[4px] rounded-full bg-purple-400 dark:bg-purple-400"
|
||||
className="w-[4px] h-[4px] rounded-full bg-neutral-400 dark:bg-neutral-400"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@ -2096,10 +2240,10 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'w-8 h-8 rounded-full border flex items-center justify-center transition-all active:scale-95 shadow-sm',
|
||||
!asrEnabled
|
||||
? 'bg-gray-100 dark:bg-gray-800/50 text-gray-300 dark:text-gray-600 border-gray-200 dark:border-gray-700 cursor-not-allowed'
|
||||
? 'bg-neutral-100 dark:bg-neutral-800/50 text-neutral-300 dark:text-neutral-600 border-neutral-200 dark:border-neutral-700 cursor-not-allowed'
|
||||
: isVoiceOpen
|
||||
? 'bg-purple-600 dark:bg-purple-500 border-purple-600 dark:border-purple-500 text-white shadow-purple-200 dark:shadow-purple-800'
|
||||
: 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 text-gray-400 dark:text-gray-500 hover:bg-purple-50 dark:hover:bg-purple-900/20 hover:text-purple-600 dark:hover:text-purple-400 hover:border-purple-200 dark:hover:border-purple-700',
|
||||
? 'bg-neutral-600 dark:bg-neutral-500 border-neutral-600 dark:border-neutral-500 text-white shadow-neutral-200 dark:shadow-neutral-800'
|
||||
: 'bg-white dark:bg-neutral-800 border-neutral-200 dark:border-neutral-700 text-neutral-400 dark:text-neutral-500 hover:bg-neutral-50 dark:hover:bg-neutral-900/20 hover:text-neutral-600 dark:hover:text-neutral-400 hover:border-neutral-200 dark:hover:border-neutral-700',
|
||||
)}
|
||||
>
|
||||
{asrEnabled ? (
|
||||
@ -2116,8 +2260,8 @@ export function Roundtable({
|
||||
className={cn(
|
||||
'w-8 h-8 rounded-full border flex items-center justify-center transition-all active:scale-95 shadow-sm',
|
||||
isInputOpen
|
||||
? 'bg-purple-600 dark:bg-purple-500 border-purple-600 dark:border-purple-500 text-white shadow-purple-200 dark:shadow-purple-800'
|
||||
: 'bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 text-gray-400 dark:text-gray-500 hover:bg-purple-50 dark:hover:bg-purple-900/20 hover:text-purple-600 dark:hover:text-purple-400 hover:border-purple-200 dark:hover:border-purple-700',
|
||||
? 'bg-neutral-600 dark:bg-neutral-500 border-neutral-600 dark:border-neutral-500 text-white shadow-neutral-200 dark:shadow-neutral-800'
|
||||
: 'bg-white dark:bg-neutral-800 border-neutral-200 dark:border-neutral-700 text-neutral-400 dark:text-neutral-500 hover:bg-neutral-50 dark:hover:bg-neutral-900/20 hover:text-neutral-600 dark:hover:text-neutral-400 hover:border-neutral-200 dark:hover:border-neutral-700',
|
||||
)}
|
||||
>
|
||||
<MessageSquare className="w-3.5 h-3.5" />
|
||||
@ -2148,20 +2292,20 @@ export function Roundtable({
|
||||
isCueUser
|
||||
? 'border-amber-500 dark:border-amber-400 shadow-[0_0_12px_rgba(245,158,11,0.4)] animate-pulse'
|
||||
: activeRole === 'user' || isInputOpen
|
||||
? 'border-purple-600 dark:border-purple-400 shadow-[0_0_8px_rgba(168,85,247,0.3)]'
|
||||
: 'border-white dark:border-gray-700 group-hover:border-purple-200 dark:group-hover:border-purple-600',
|
||||
? 'border-neutral-600 dark:border-neutral-400 shadow-[0_0_8px_rgba(0,0,0,0.08)]'
|
||||
: 'border-white dark:border-neutral-700 group-hover:border-neutral-200 dark:group-hover:border-neutral-600',
|
||||
)}
|
||||
/>
|
||||
<div className="w-14 h-14 rounded-full bg-gray-50 dark:bg-gray-800 overflow-hidden relative z-10 shadow-sm border border-gray-50 dark:border-gray-700 text-2xl">
|
||||
<div className="w-14 h-14 rounded-full bg-neutral-50 dark:bg-neutral-800 overflow-hidden relative z-10 shadow-sm border border-neutral-50 dark:border-neutral-700 text-2xl">
|
||||
<AvatarDisplay src={userAvatar} alt={t('roundtable.you')} />
|
||||
</div>
|
||||
<div className="absolute top-0 right-0 w-5 h-5 bg-white dark:bg-gray-800 rounded-full flex items-center justify-center shadow-md border border-gray-100 dark:border-gray-700 z-20">
|
||||
<div className="absolute top-0 right-0 w-5 h-5 bg-white dark:bg-neutral-800 rounded-full flex items-center justify-center shadow-md border border-neutral-100 dark:border-neutral-700 z-20">
|
||||
<div
|
||||
className={cn(
|
||||
'w-1.5 h-1.5 rounded-full',
|
||||
isInputOpen || isCueUser
|
||||
? 'bg-purple-500 animate-pulse'
|
||||
: 'bg-gray-300 dark:bg-gray-600',
|
||||
? 'bg-neutral-500 animate-pulse'
|
||||
: 'bg-neutral-300 dark:bg-neutral-600',
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
* one it's been asked to show.
|
||||
*/
|
||||
|
||||
import { DEFAULT_BRAND } from '@/lib/brand/brand-config';
|
||||
import type { PBLMilestone, PBLProjectV2 } from '@/lib/pbl/v2/types';
|
||||
import Image from 'next/image';
|
||||
import { Maximize2, Workflow } from 'lucide-react';
|
||||
@ -442,11 +443,11 @@ function WorkspaceTopBar({
|
||||
<div className="relative flex min-w-0 flex-1 items-center gap-3">
|
||||
<div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-violet-200/25 bg-violet-100/[0.08] shadow-[0_0_24px_rgba(157,140,255,0.18)]">
|
||||
<Image
|
||||
src="/openmaic-mark.png"
|
||||
alt="OpenMAIC"
|
||||
src={DEFAULT_BRAND.markSrc}
|
||||
alt={DEFAULT_BRAND.productName}
|
||||
width={28}
|
||||
height={28}
|
||||
className="h-6 w-6"
|
||||
className="h-6 w-6 rounded bg-white object-contain"
|
||||
/>
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
|
||||
@ -161,19 +161,19 @@ function QuizCover({
|
||||
<div className="w-full h-full flex flex-col items-center justify-center gap-4 relative overflow-hidden">
|
||||
{/* Background decoration */}
|
||||
<div className="absolute top-0 right-0 p-6 opacity-[0.03]">
|
||||
<PieChart className="w-52 h-52 text-violet-500" />
|
||||
<PieChart className="w-52 h-52 text-neutral-500" />
|
||||
</div>
|
||||
<div className="absolute bottom-0 left-0 p-6 opacity-[0.02]">
|
||||
<BookOpenText className="w-40 h-40 text-violet-500 rotate-12" />
|
||||
<BookOpenText className="w-40 h-40 text-neutral-500 rotate-12" />
|
||||
</div>
|
||||
|
||||
<motion.div
|
||||
initial={{ scale: 0.8, opacity: 0 }}
|
||||
animate={{ scale: 1, opacity: 1 }}
|
||||
transition={{ type: 'spring', stiffness: 200, damping: 20 }}
|
||||
className="w-16 h-16 bg-gradient-to-br from-violet-100 to-purple-50 dark:from-violet-900/50 dark:to-purple-900/30 rounded-2xl flex items-center justify-center shadow-lg shadow-violet-100 dark:shadow-violet-900/30 ring-1 ring-violet-200/50 dark:ring-violet-700/50"
|
||||
className="w-16 h-16 bg-gradient-to-br from-neutral-100 to-neutral-50 dark:from-neutral-900/50 dark:to-neutral-900/30 rounded-2xl flex items-center justify-center shadow-lg shadow-neutral-100 dark:shadow-neutral-900/30 ring-1 ring-neutral-200/50 dark:ring-neutral-700/50"
|
||||
>
|
||||
<PieChart className="w-8 h-8 text-violet-500" />
|
||||
<PieChart className="w-8 h-8 text-neutral-500" />
|
||||
</motion.div>
|
||||
|
||||
<motion.div
|
||||
@ -182,8 +182,10 @@ function QuizCover({
|
||||
transition={{ delay: 0.1 }}
|
||||
className="text-center z-10"
|
||||
>
|
||||
<h3 className="text-xl font-bold text-gray-800 dark:text-gray-100">{t('quiz.title')}</h3>
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400 mt-1">{t('quiz.subtitle')}</p>
|
||||
<h3 className="text-xl font-bold text-neutral-800 dark:text-neutral-100">
|
||||
{t('quiz.title')}
|
||||
</h3>
|
||||
<p className="text-sm text-neutral-500 dark:text-neutral-400 mt-1">{t('quiz.subtitle')}</p>
|
||||
</motion.div>
|
||||
|
||||
<motion.div
|
||||
@ -192,17 +194,17 @@ function QuizCover({
|
||||
transition={{ delay: 0.2 }}
|
||||
className="flex gap-5 text-sm z-10"
|
||||
>
|
||||
<div className="flex items-center gap-2 text-gray-500 dark:text-gray-400">
|
||||
<div className="w-7 h-7 rounded-lg bg-violet-50 dark:bg-violet-900/30 flex items-center justify-center">
|
||||
<BookOpenText className="w-3.5 h-3.5 text-violet-500" />
|
||||
<div className="flex items-center gap-2 text-neutral-500 dark:text-neutral-400">
|
||||
<div className="w-7 h-7 rounded-lg bg-neutral-50 dark:bg-neutral-900/30 flex items-center justify-center">
|
||||
<BookOpenText className="w-3.5 h-3.5 text-neutral-500" />
|
||||
</div>
|
||||
<span>
|
||||
{questionCount} {t('quiz.questionsCount')}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-gray-500 dark:text-gray-400">
|
||||
<div className="w-7 h-7 rounded-lg bg-violet-50 dark:bg-violet-900/30 flex items-center justify-center">
|
||||
<PieChart className="w-3.5 h-3.5 text-violet-500" />
|
||||
<div className="flex items-center gap-2 text-neutral-500 dark:text-neutral-400">
|
||||
<div className="w-7 h-7 rounded-lg bg-neutral-50 dark:bg-neutral-900/30 flex items-center justify-center">
|
||||
<PieChart className="w-3.5 h-3.5 text-neutral-500" />
|
||||
</div>
|
||||
<span>
|
||||
{t('quiz.totalPrefix')} {totalPoints} {t('quiz.pointsSuffix')}
|
||||
@ -217,7 +219,7 @@ function QuizCover({
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.95 }}
|
||||
onClick={onStart}
|
||||
className="mt-1 px-8 py-2.5 bg-gradient-to-r from-violet-500 to-purple-500 text-white rounded-full font-medium shadow-lg shadow-violet-200/50 dark:shadow-violet-900/50 hover:shadow-violet-300/50 transition-shadow z-10 flex items-center gap-2"
|
||||
className="mt-1 px-8 py-2.5 bg-gradient-to-r from-neutral-500 to-neutral-500 text-white rounded-full font-medium shadow-lg shadow-neutral-200/50 dark:shadow-neutral-900/50 hover:shadow-neutral-300/50 transition-shadow z-10 flex items-center gap-2"
|
||||
>
|
||||
{t('quiz.startQuiz')}
|
||||
<ChevronRight className="w-4 h-4" />
|
||||
@ -261,10 +263,10 @@ function SingleChoiceQuestion({
|
||||
// Default state
|
||||
!isReview &&
|
||||
!selected &&
|
||||
'border-gray-200 dark:border-gray-600 hover:border-violet-200 dark:hover:border-violet-700 hover:bg-violet-50/50 dark:hover:bg-violet-900/30',
|
||||
'border-neutral-200 dark:border-neutral-600 hover:border-neutral-200 dark:hover:border-neutral-700 hover:bg-neutral-50/50 dark:hover:bg-neutral-900/30',
|
||||
!isReview &&
|
||||
selected &&
|
||||
'border-violet-400 bg-violet-50 dark:bg-violet-900/30 ring-1 ring-violet-200 dark:ring-violet-700',
|
||||
'border-neutral-400 bg-neutral-50 dark:bg-neutral-900/30 ring-1 ring-neutral-200 dark:ring-neutral-700',
|
||||
// Review states
|
||||
isReview &&
|
||||
isCorrectOpt &&
|
||||
@ -276,7 +278,7 @@ function SingleChoiceQuestion({
|
||||
isReview &&
|
||||
!isCorrectOpt &&
|
||||
!selected &&
|
||||
'border-gray-100 dark:border-gray-700 opacity-60',
|
||||
'border-neutral-100 dark:border-neutral-700 opacity-60',
|
||||
disabled && !isReview && 'cursor-default',
|
||||
)}
|
||||
>
|
||||
@ -285,14 +287,14 @@ function SingleChoiceQuestion({
|
||||
'w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold shrink-0 transition-colors',
|
||||
!isReview &&
|
||||
!selected &&
|
||||
'bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400',
|
||||
!isReview && selected && 'bg-violet-500 text-white',
|
||||
'bg-neutral-100 dark:bg-neutral-700 text-neutral-500 dark:text-neutral-400',
|
||||
!isReview && selected && 'bg-neutral-500 text-white',
|
||||
isReview && isCorrectOpt && 'bg-emerald-500 text-white',
|
||||
isReview && isWrong && !isCorrectOpt && 'bg-red-400 text-white',
|
||||
isReview &&
|
||||
!isCorrectOpt &&
|
||||
!selected &&
|
||||
'bg-gray-100 dark:bg-gray-700 text-gray-400 dark:text-gray-500',
|
||||
'bg-neutral-100 dark:bg-neutral-700 text-neutral-400 dark:text-neutral-500',
|
||||
)}
|
||||
>
|
||||
{opt.value}
|
||||
@ -300,7 +302,10 @@ function SingleChoiceQuestion({
|
||||
<span
|
||||
className={cn(
|
||||
'flex-1',
|
||||
isReview && !isCorrectOpt && !selected && 'text-gray-400 dark:text-gray-500',
|
||||
isReview &&
|
||||
!isCorrectOpt &&
|
||||
!selected &&
|
||||
'text-neutral-400 dark:text-neutral-500',
|
||||
)}
|
||||
>
|
||||
<QuizMathText text={opt.label} />
|
||||
@ -351,7 +356,7 @@ function MultipleChoiceQuestion({
|
||||
return (
|
||||
<QuestionCard question={question} index={index} result={result}>
|
||||
{!isReview && (
|
||||
<p className="text-xs text-gray-400 dark:text-gray-500 mb-2">
|
||||
<p className="text-xs text-neutral-400 dark:text-neutral-500 mb-2">
|
||||
{t('quiz.multipleChoiceHint')}
|
||||
</p>
|
||||
)}
|
||||
@ -370,10 +375,10 @@ function MultipleChoiceQuestion({
|
||||
'flex items-center gap-3 px-4 py-3 rounded-xl border text-left transition-all text-sm',
|
||||
!isReview &&
|
||||
!isSelected &&
|
||||
'border-gray-200 dark:border-gray-600 hover:border-violet-200 dark:hover:border-violet-700 hover:bg-violet-50/50 dark:hover:bg-violet-900/30',
|
||||
'border-neutral-200 dark:border-neutral-600 hover:border-neutral-200 dark:hover:border-neutral-700 hover:bg-neutral-50/50 dark:hover:bg-neutral-900/30',
|
||||
!isReview &&
|
||||
isSelected &&
|
||||
'border-violet-400 bg-violet-50 dark:bg-violet-900/30 ring-1 ring-violet-200 dark:ring-violet-700',
|
||||
'border-neutral-400 bg-neutral-50 dark:bg-neutral-900/30 ring-1 ring-neutral-200 dark:ring-neutral-700',
|
||||
isReview &&
|
||||
isCorrectOpt &&
|
||||
'border-emerald-400 bg-emerald-50 dark:bg-emerald-900/30',
|
||||
@ -381,7 +386,7 @@ function MultipleChoiceQuestion({
|
||||
isReview &&
|
||||
!isCorrectOpt &&
|
||||
!isSelected &&
|
||||
'border-gray-100 dark:border-gray-700 opacity-60',
|
||||
'border-neutral-100 dark:border-neutral-700 opacity-60',
|
||||
disabled && !isReview && 'cursor-default',
|
||||
)}
|
||||
>
|
||||
@ -390,14 +395,14 @@ function MultipleChoiceQuestion({
|
||||
'w-7 h-7 rounded-lg flex items-center justify-center text-xs font-bold shrink-0 transition-colors',
|
||||
!isReview &&
|
||||
!isSelected &&
|
||||
'bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400',
|
||||
!isReview && isSelected && 'bg-violet-500 text-white',
|
||||
'bg-neutral-100 dark:bg-neutral-700 text-neutral-500 dark:text-neutral-400',
|
||||
!isReview && isSelected && 'bg-neutral-500 text-white',
|
||||
isReview && isCorrectOpt && 'bg-emerald-500 text-white',
|
||||
isReview && isWrong && 'bg-red-400 text-white',
|
||||
isReview &&
|
||||
!isCorrectOpt &&
|
||||
!isSelected &&
|
||||
'bg-gray-100 dark:bg-gray-700 text-gray-400 dark:text-gray-500',
|
||||
'bg-neutral-100 dark:bg-neutral-700 text-neutral-400 dark:text-neutral-500',
|
||||
)}
|
||||
>
|
||||
{!isReview && isSelected ? <Check className="w-3.5 h-3.5" /> : opt.value}
|
||||
@ -405,7 +410,10 @@ function MultipleChoiceQuestion({
|
||||
<span
|
||||
className={cn(
|
||||
'flex-1',
|
||||
isReview && !isCorrectOpt && !isSelected && 'text-gray-400 dark:text-gray-500',
|
||||
isReview &&
|
||||
!isCorrectOpt &&
|
||||
!isSelected &&
|
||||
'text-neutral-400 dark:text-neutral-500',
|
||||
)}
|
||||
>
|
||||
<QuizMathText text={opt.label} />
|
||||
@ -454,7 +462,7 @@ function ShortAnswerQuestion({
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
disabled={disabled}
|
||||
placeholder={t('quiz.inputPlaceholder')}
|
||||
className="w-full min-h-[100px] p-3 pb-10 rounded-xl border border-gray-200 dark:border-gray-600 text-sm resize-none focus:outline-none focus:border-violet-300 dark:focus:border-violet-600 focus:ring-2 focus:ring-violet-100 dark:focus:ring-violet-900/50 transition-all disabled:bg-gray-50 dark:disabled:bg-gray-800 disabled:text-gray-500 dark:bg-gray-800/50 dark:text-gray-200 dark:placeholder:text-gray-500"
|
||||
className="w-full min-h-[100px] p-3 pb-10 rounded-xl border border-neutral-200 dark:border-neutral-600 text-sm resize-none focus:outline-none focus:border-neutral-300 dark:focus:border-neutral-600 focus:ring-2 focus:ring-neutral-100 dark:focus:ring-neutral-900/50 transition-all disabled:bg-neutral-50 dark:disabled:bg-neutral-800 disabled:text-neutral-500 dark:bg-neutral-800/50 dark:text-neutral-200 dark:placeholder:text-neutral-500"
|
||||
/>
|
||||
<SpeechButton
|
||||
size="sm"
|
||||
@ -465,34 +473,36 @@ function ShortAnswerQuestion({
|
||||
onChange(cur + (cur ? ' ' : '') + text);
|
||||
}}
|
||||
/>
|
||||
<span className="absolute bottom-3 right-3 text-xs text-gray-300 dark:text-gray-600">
|
||||
<span className="absolute bottom-3 right-3 text-xs text-neutral-300 dark:text-neutral-600">
|
||||
{(value ?? '').length} {t('quiz.charCount')}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<div className="p-3 rounded-xl bg-gray-50 dark:bg-gray-800/50 border border-gray-100 dark:border-gray-700 text-sm text-gray-700 dark:text-gray-300">
|
||||
<p className="text-xs text-gray-400 dark:text-gray-500 mb-1">{t('quiz.yourAnswer')}</p>
|
||||
<div className="p-3 rounded-xl bg-neutral-50 dark:bg-neutral-800/50 border border-neutral-100 dark:border-neutral-700 text-sm text-neutral-700 dark:text-neutral-300">
|
||||
<p className="text-xs text-neutral-400 dark:text-neutral-500 mb-1">
|
||||
{t('quiz.yourAnswer')}
|
||||
</p>
|
||||
{value ? (
|
||||
<QuizMathText text={value} />
|
||||
) : (
|
||||
<span className="text-gray-400 dark:text-gray-500 italic">
|
||||
<span className="text-neutral-400 dark:text-neutral-500 italic">
|
||||
{t('quiz.notAnswered')}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{result.aiComment && (
|
||||
<div className="flex items-start gap-2 px-3 py-2 rounded-lg bg-violet-50 dark:bg-violet-900/30 border border-violet-100 dark:border-violet-800">
|
||||
<Sparkles className="w-4 h-4 text-violet-500 shrink-0 mt-0.5" />
|
||||
<div className="flex items-start gap-2 px-3 py-2 rounded-lg bg-neutral-50 dark:bg-neutral-900/30 border border-neutral-100 dark:border-neutral-800">
|
||||
<Sparkles className="w-4 h-4 text-neutral-500 shrink-0 mt-0.5" />
|
||||
<div>
|
||||
<p className="text-xs font-medium text-violet-600 dark:text-violet-400 mb-0.5">
|
||||
<p className="text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-0.5">
|
||||
{t('quiz.aiComment')}
|
||||
</p>
|
||||
<p className="text-xs text-violet-600/80 dark:text-violet-400/80">
|
||||
<p className="text-xs text-neutral-600/80 dark:text-neutral-400/80">
|
||||
<QuizMathText text={result.aiComment} />
|
||||
</p>
|
||||
</div>
|
||||
<span className="ml-auto text-xs font-bold text-violet-600 dark:text-violet-400 shrink-0">
|
||||
<span className="ml-auto text-xs font-bold text-neutral-600 dark:text-neutral-400 shrink-0">
|
||||
{result.earned}/{question.points ?? 1}
|
||||
{t('quiz.pointsSuffix')}
|
||||
</span>
|
||||
@ -525,8 +535,8 @@ function QuestionCard({
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ delay: index * 0.05 }}
|
||||
className={cn(
|
||||
'bg-white dark:bg-gray-800 rounded-2xl border p-5 relative overflow-hidden',
|
||||
!isReview && 'border-gray-150 dark:border-gray-700 shadow-sm',
|
||||
'bg-white dark:bg-neutral-800 rounded-2xl border p-5 relative overflow-hidden',
|
||||
!isReview && 'border-neutral-150 dark:border-neutral-700 shadow-sm',
|
||||
isReview &&
|
||||
result.status === 'correct' &&
|
||||
'border-emerald-200 dark:border-emerald-800 shadow-sm shadow-emerald-50 dark:shadow-emerald-900/20',
|
||||
@ -539,7 +549,7 @@ function QuestionCard({
|
||||
<div
|
||||
className={cn(
|
||||
'absolute left-0 top-0 bottom-0 w-1 rounded-l-2xl',
|
||||
!isReview && 'bg-violet-400',
|
||||
!isReview && 'bg-neutral-400',
|
||||
isReview && result.status === 'correct' && 'bg-emerald-400',
|
||||
isReview && result.status === 'incorrect' && 'bg-red-400',
|
||||
)}
|
||||
@ -552,7 +562,7 @@ function QuestionCard({
|
||||
className={cn(
|
||||
'w-7 h-7 rounded-lg flex items-center justify-center text-xs font-bold shrink-0',
|
||||
!isReview &&
|
||||
'bg-violet-100 dark:bg-violet-900/50 text-violet-600 dark:text-violet-400',
|
||||
'bg-neutral-100 dark:bg-neutral-900/50 text-neutral-600 dark:text-neutral-400',
|
||||
isReview &&
|
||||
result.status === 'correct' &&
|
||||
'bg-emerald-100 dark:bg-emerald-900/50 text-emerald-600 dark:text-emerald-400',
|
||||
@ -564,10 +574,10 @@ function QuestionCard({
|
||||
{index + 1}
|
||||
</span>
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-800 dark:text-gray-100 leading-relaxed">
|
||||
<div className="text-sm font-medium text-neutral-800 dark:text-neutral-100 leading-relaxed">
|
||||
<QuizMathText text={question.question} allowDisplayMode />
|
||||
</div>
|
||||
<p className="text-xs text-gray-400 mt-0.5">
|
||||
<p className="text-xs text-neutral-400 mt-0.5">
|
||||
{question.type === 'single'
|
||||
? t('quiz.singleChoice')
|
||||
: question.type === 'multiple'
|
||||
@ -880,11 +890,11 @@ export function QuizView({ questions, sceneId, stageId }: QuizViewProps) {
|
||||
|
||||
if (runtimeGate.status === 'error') {
|
||||
return (
|
||||
<div className="flex h-full w-full items-center justify-center bg-gray-50 dark:bg-gray-900">
|
||||
<div className="flex h-full w-full items-center justify-center bg-neutral-50 dark:bg-neutral-900">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setHydrationVersion((version) => version + 1)}
|
||||
className="flex items-center gap-2 rounded-lg bg-violet-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-violet-700"
|
||||
className="flex items-center gap-2 rounded-lg bg-neutral-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-neutral-700"
|
||||
>
|
||||
<RotateCcw className="h-4 w-4" />
|
||||
{t('quiz.retry')}
|
||||
@ -895,14 +905,14 @@ export function QuizView({ questions, sceneId, stageId }: QuizViewProps) {
|
||||
|
||||
if (!isQuizRuntimeReady(runtimeGate)) {
|
||||
return (
|
||||
<div className="flex h-full w-full items-center justify-center bg-gray-50 dark:bg-gray-900">
|
||||
<Loader2 className="h-6 w-6 animate-spin text-gray-400" />
|
||||
<div className="flex h-full w-full items-center justify-center bg-neutral-50 dark:bg-neutral-900">
|
||||
<Loader2 className="h-6 w-6 animate-spin text-neutral-400" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="w-full h-full bg-gradient-to-b from-gray-50 to-white dark:from-gray-900 dark:to-gray-900 overflow-hidden flex flex-col">
|
||||
<div className="w-full h-full bg-gradient-to-b from-neutral-50 to-white dark:from-neutral-900 dark:to-neutral-900 overflow-hidden flex flex-col">
|
||||
<AnimatePresence mode="wait">
|
||||
{phase === 'not_started' && (
|
||||
<motion.div
|
||||
@ -929,13 +939,13 @@ export function QuizView({ questions, sceneId, stageId }: QuizViewProps) {
|
||||
className="flex-1 flex flex-col min-h-0"
|
||||
>
|
||||
{/* Header bar */}
|
||||
<div className="flex items-center justify-between px-6 py-3 border-b border-gray-100 dark:border-gray-700 bg-white/80 dark:bg-gray-900/80 backdrop-blur shrink-0">
|
||||
<div className="flex items-center justify-between px-6 py-3 border-b border-neutral-100 dark:border-neutral-700 bg-white/80 dark:bg-neutral-900/80 backdrop-blur shrink-0">
|
||||
<div className="flex items-center gap-2">
|
||||
<PieChart className="w-4 h-4 text-violet-500" />
|
||||
<span className="text-sm font-semibold text-gray-700 dark:text-gray-200">
|
||||
<PieChart className="w-4 h-4 text-neutral-500" />
|
||||
<span className="text-sm font-semibold text-neutral-700 dark:text-neutral-200">
|
||||
{t('quiz.answering')}
|
||||
</span>
|
||||
<span className="text-xs text-gray-400 ml-1">
|
||||
<span className="text-xs text-neutral-400 ml-1">
|
||||
{
|
||||
Object.keys(answers).filter((k) => {
|
||||
const a = answers[k];
|
||||
@ -953,8 +963,8 @@ export function QuizView({ questions, sceneId, stageId }: QuizViewProps) {
|
||||
className={cn(
|
||||
'px-4 py-1.5 rounded-lg text-xs font-medium transition-all',
|
||||
allAnswered
|
||||
? 'bg-gradient-to-r from-violet-500 to-purple-500 text-white shadow-sm hover:shadow-md hover:shadow-violet-200/50 dark:hover:shadow-violet-900/50 active:scale-[0.97]'
|
||||
: 'bg-gray-100 dark:bg-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed',
|
||||
? 'bg-gradient-to-r from-neutral-500 to-neutral-500 text-white shadow-sm hover:shadow-md hover:shadow-neutral-200/50 dark:hover:shadow-neutral-900/50 active:scale-[0.97]'
|
||||
: 'bg-neutral-100 dark:bg-neutral-700 text-neutral-400 dark:text-neutral-500 cursor-not-allowed',
|
||||
)}
|
||||
>
|
||||
{t('quiz.submitAnswers')}
|
||||
@ -1012,19 +1022,19 @@ export function QuizView({ questions, sceneId, stageId }: QuizViewProps) {
|
||||
animate={{ rotate: 360 }}
|
||||
transition={{ repeat: Infinity, duration: 1.5, ease: 'linear' }}
|
||||
>
|
||||
<Loader2 className="w-10 h-10 text-violet-500" />
|
||||
<Loader2 className="w-10 h-10 text-neutral-500" />
|
||||
</motion.div>
|
||||
<div className="text-center">
|
||||
<p className="text-base font-semibold text-gray-700 dark:text-gray-200">
|
||||
<p className="text-base font-semibold text-neutral-700 dark:text-neutral-200">
|
||||
{t('quiz.aiGrading')}
|
||||
</p>
|
||||
<p className="text-sm text-gray-400 mt-1">{t('quiz.aiGradingWait')}</p>
|
||||
<p className="text-sm text-neutral-400 mt-1">{t('quiz.aiGradingWait')}</p>
|
||||
</div>
|
||||
<div className="flex gap-1 mt-2">
|
||||
{[0, 1, 2].map((i) => (
|
||||
<motion.div
|
||||
key={i}
|
||||
className="w-2 h-2 rounded-full bg-violet-400"
|
||||
className="w-2 h-2 rounded-full bg-neutral-400"
|
||||
animate={{ opacity: [0.3, 1, 0.3] }}
|
||||
transition={{
|
||||
repeat: Infinity,
|
||||
@ -1045,10 +1055,10 @@ export function QuizView({ questions, sceneId, stageId }: QuizViewProps) {
|
||||
className="flex-1 flex flex-col min-h-0"
|
||||
>
|
||||
{/* Header bar */}
|
||||
<div className="flex items-center justify-between px-6 py-3 border-b border-gray-100 dark:border-gray-700 bg-white/80 dark:bg-gray-900/80 backdrop-blur shrink-0">
|
||||
<div className="flex items-center justify-between px-6 py-3 border-b border-neutral-100 dark:border-neutral-700 bg-white/80 dark:bg-neutral-900/80 backdrop-blur shrink-0">
|
||||
<div className="flex items-center gap-2">
|
||||
<CheckCircle2 className="w-4 h-4 text-emerald-500" />
|
||||
<span className="text-sm font-semibold text-gray-700 dark:text-gray-200">
|
||||
<span className="text-sm font-semibold text-neutral-700 dark:text-neutral-200">
|
||||
{t('quiz.quizReport')}
|
||||
</span>
|
||||
</div>
|
||||
@ -1056,7 +1066,7 @@ export function QuizView({ questions, sceneId, stageId }: QuizViewProps) {
|
||||
type="button"
|
||||
onClick={() => void handleRetry()}
|
||||
disabled={retrying}
|
||||
className="flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400 hover:text-violet-600 dark:hover:text-violet-400 transition-colors disabled:cursor-not-allowed disabled:opacity-50"
|
||||
className="flex items-center gap-1.5 text-xs text-neutral-500 dark:text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-400 transition-colors disabled:cursor-not-allowed disabled:opacity-50"
|
||||
>
|
||||
<RotateCcw className="w-3.5 h-3.5" />
|
||||
{t('quiz.retry')}
|
||||
|
||||
@ -130,7 +130,7 @@ export function AgentSettings({
|
||||
? 'bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 border border-red-200 dark:border-red-800'
|
||||
: selectedAgentIds.length === 1
|
||||
? 'bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-800'
|
||||
: 'bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-800'
|
||||
: 'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-700 dark:text-neutral-300 border border-neutral-200 dark:border-neutral-800'
|
||||
}`}
|
||||
>
|
||||
{selectedAgentIds.length === 0 && (
|
||||
|
||||
@ -86,7 +86,7 @@ function ProviderListColumn<T extends string>({
|
||||
onAdd?: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex-shrink-0 bg-background flex flex-col" style={{ width }}>
|
||||
<div className="settings-providers flex-shrink-0 bg-background flex flex-col" style={{ width }}>
|
||||
<div className="flex-1 overflow-y-auto p-3 space-y-1.5">
|
||||
{providers.map((provider) => (
|
||||
<button
|
||||
@ -733,12 +733,18 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="h-[85vh] p-0 gap-0 block" showCloseButton={false}>
|
||||
<DialogContent
|
||||
className="settings-dialog h-[85dvh] max-w-[calc(100%-2rem)] md:max-w-3/4 p-0 gap-0 block"
|
||||
showCloseButton={false}
|
||||
>
|
||||
<DialogTitle className="sr-only">{t('settings.title')}</DialogTitle>
|
||||
<DialogDescription className="sr-only">{t('settings.description')}</DialogDescription>
|
||||
<div className="flex h-full overflow-hidden">
|
||||
<div className="flex h-full flex-col md:flex-row overflow-hidden">
|
||||
{/* Left Sidebar - Navigation */}
|
||||
<div className="flex-shrink-0 bg-muted/30 p-3 space-y-1" style={{ width: sidebarWidth }}>
|
||||
<div
|
||||
className="settings-navigation flex-shrink-0 bg-sidebar p-3 space-y-1"
|
||||
style={{ width: sidebarWidth }}
|
||||
>
|
||||
<button
|
||||
onClick={() => setActiveSection('token-plan')}
|
||||
className={cn(
|
||||
@ -873,7 +879,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
{/* Sidebar resize handle */}
|
||||
<div
|
||||
onMouseDown={(e) => handleResizeStart(e, 'sidebar')}
|
||||
className="flex-shrink-0 w-[5px] cursor-col-resize group flex justify-center"
|
||||
className="hidden md:flex flex-shrink-0 w-[5px] cursor-col-resize group justify-center"
|
||||
>
|
||||
<div className="w-px h-full bg-border group-hover:bg-primary/50 transition-colors" />
|
||||
</div>
|
||||
@ -890,7 +896,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
/>
|
||||
<div
|
||||
onMouseDown={(e) => handleResizeStart(e, 'providerList')}
|
||||
className="flex-shrink-0 w-[5px] cursor-col-resize group flex justify-center"
|
||||
className="hidden md:flex flex-shrink-0 w-[5px] cursor-col-resize group justify-center"
|
||||
>
|
||||
<div className="w-px h-full bg-border group-hover:bg-primary/50 transition-colors" />
|
||||
</div>
|
||||
@ -909,7 +915,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
/>
|
||||
<div
|
||||
onMouseDown={(e) => handleResizeStart(e, 'providerList')}
|
||||
className="flex-shrink-0 w-[5px] cursor-col-resize group flex justify-center"
|
||||
className="hidden md:flex flex-shrink-0 w-[5px] cursor-col-resize group justify-center"
|
||||
>
|
||||
<div className="w-px h-full bg-border group-hover:bg-primary/50 transition-colors" />
|
||||
</div>
|
||||
@ -931,7 +937,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
/>
|
||||
<div
|
||||
onMouseDown={(e) => handleResizeStart(e, 'providerList')}
|
||||
className="flex-shrink-0 w-[5px] cursor-col-resize group flex justify-center"
|
||||
className="hidden md:flex flex-shrink-0 w-[5px] cursor-col-resize group justify-center"
|
||||
>
|
||||
<div className="w-px h-full bg-border group-hover:bg-primary/50 transition-colors" />
|
||||
</div>
|
||||
@ -954,7 +960,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
/>
|
||||
<div
|
||||
onMouseDown={(e) => handleResizeStart(e, 'providerList')}
|
||||
className="flex-shrink-0 w-[5px] cursor-col-resize group flex justify-center"
|
||||
className="hidden md:flex flex-shrink-0 w-[5px] cursor-col-resize group justify-center"
|
||||
>
|
||||
<div className="w-px h-full bg-border group-hover:bg-primary/50 transition-colors" />
|
||||
</div>
|
||||
@ -977,7 +983,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
/>
|
||||
<div
|
||||
onMouseDown={(e) => handleResizeStart(e, 'providerList')}
|
||||
className="flex-shrink-0 w-[5px] cursor-col-resize group flex justify-center"
|
||||
className="hidden md:flex flex-shrink-0 w-[5px] cursor-col-resize group justify-center"
|
||||
>
|
||||
<div className="w-px h-full bg-border group-hover:bg-primary/50 transition-colors" />
|
||||
</div>
|
||||
@ -1010,7 +1016,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
/>
|
||||
<div
|
||||
onMouseDown={(e) => handleResizeStart(e, 'providerList')}
|
||||
className="flex-shrink-0 w-[5px] cursor-col-resize group flex justify-center"
|
||||
className="hidden md:flex flex-shrink-0 w-[5px] cursor-col-resize group justify-center"
|
||||
>
|
||||
<div className="w-px h-full bg-border group-hover:bg-primary/50 transition-colors" />
|
||||
</div>
|
||||
@ -1043,7 +1049,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
/>
|
||||
<div
|
||||
onMouseDown={(e) => handleResizeStart(e, 'providerList')}
|
||||
className="flex-shrink-0 w-[5px] cursor-col-resize group flex justify-center"
|
||||
className="hidden md:flex flex-shrink-0 w-[5px] cursor-col-resize group justify-center"
|
||||
>
|
||||
<div className="w-px h-full bg-border group-hover:bg-primary/50 transition-colors" />
|
||||
</div>
|
||||
@ -1051,7 +1057,7 @@ export function SettingsDialog({ open, onOpenChange, initialSection }: SettingsD
|
||||
)}
|
||||
|
||||
{/* Right - Configuration Panel */}
|
||||
<div className="flex-1 flex flex-col overflow-hidden min-w-0">
|
||||
<div className="flex-1 flex flex-col overflow-hidden min-w-0 min-h-0">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between p-5 border-b">
|
||||
<div className="flex items-center gap-3">{getHeaderContent()}</div>
|
||||
|
||||
@ -37,7 +37,10 @@ export function ProviderList({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex-shrink-0 bg-background flex flex-col" style={{ width: width ?? 192 }}>
|
||||
<div
|
||||
className="settings-providers flex-shrink-0 bg-background flex flex-col"
|
||||
style={{ width: width ?? 192 }}
|
||||
>
|
||||
<div className="flex-1 overflow-y-auto p-3 space-y-1.5">
|
||||
{providers.map((provider) => (
|
||||
<button
|
||||
|
||||
@ -1546,13 +1546,13 @@ function VoiceProfileRow({
|
||||
}) {
|
||||
const iconClassName =
|
||||
kind === 'auto'
|
||||
? 'bg-violet-50 text-violet-700 dark:bg-violet-950/40 dark:text-violet-300'
|
||||
? 'bg-neutral-50 text-neutral-700 dark:bg-neutral-950/40 dark:text-neutral-300'
|
||||
: kind === 'clone'
|
||||
? 'bg-sky-50 text-sky-700 dark:bg-sky-950/40 dark:text-sky-300'
|
||||
: 'bg-muted text-muted-foreground';
|
||||
const badgeClassName =
|
||||
badgeTone === 'default'
|
||||
? 'border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-800/70 dark:bg-violet-950/40 dark:text-violet-300'
|
||||
? 'border-neutral-200 bg-neutral-50 text-neutral-700 dark:border-neutral-800/70 dark:bg-neutral-950/40 dark:text-neutral-300'
|
||||
: badgeTone === 'warning'
|
||||
? 'border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300'
|
||||
: 'border-border/70 bg-background text-muted-foreground';
|
||||
|
||||
@ -116,7 +116,7 @@ export function UsageDashboard() {
|
||||
const chart = chartInstance.current;
|
||||
const axis = isDark ? 'rgba(255,255,255,0.45)' : 'rgba(0,0,0,0.45)';
|
||||
const split = isDark ? 'rgba(255,255,255,0.06)' : 'rgba(0,0,0,0.06)';
|
||||
const accent = isDark ? '#a78bfa' : '#7c3aed'; // violet, matches primary
|
||||
const accent = isDark ? '#fb923c' : '#ea580c'; // d-sre-agent brand accent
|
||||
|
||||
chart.setOption({
|
||||
tooltip: { trigger: 'axis' },
|
||||
|
||||
@ -35,13 +35,13 @@ export function ThemeToggle() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
className="h-8 w-8 inline-flex items-center justify-center rounded-full text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-slate-800 hover:text-gray-900 dark:hover:text-gray-100 transition-all"
|
||||
className="h-8 w-8 inline-flex items-center justify-center rounded-full text-neutral-500 dark:text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-800 hover:text-neutral-900 dark:hover:text-neutral-100 transition-all"
|
||||
aria-label="Theme"
|
||||
>
|
||||
<ActiveIcon className="w-4 h-4" />
|
||||
</button>
|
||||
{open && (
|
||||
<div className="pro-theme-popover absolute top-full mt-2 right-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg overflow-hidden z-50 min-w-[140px]">
|
||||
<div className="pro-theme-popover absolute top-full mt-2 right-0 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg overflow-hidden z-50 min-w-[140px]">
|
||||
{OPTIONS.map(({ value, icon: Icon }) => (
|
||||
<button
|
||||
key={value}
|
||||
@ -50,9 +50,9 @@ export function ThemeToggle() {
|
||||
setOpen(false);
|
||||
}}
|
||||
className={cn(
|
||||
'w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex items-center gap-2',
|
||||
'w-full px-4 py-2 text-left text-sm hover:bg-neutral-100 dark:hover:bg-neutral-700 transition-colors flex items-center gap-2',
|
||||
theme === value &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400',
|
||||
'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-600 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
<Icon className="w-4 h-4" />
|
||||
|
||||
@ -116,7 +116,7 @@ export function HeaderControls({
|
||||
if (!showGlobalControls && !showCourseActions) {
|
||||
return onToggleEditMode ? (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-sm font-medium text-gray-600 dark:text-gray-300">
|
||||
<span className="text-sm font-medium text-neutral-600 dark:text-neutral-300">
|
||||
{t('stage.proMode')}
|
||||
</span>
|
||||
<Switch
|
||||
@ -137,13 +137,13 @@ export function HeaderControls({
|
||||
// the cluster pixel-stable; both hosts pad to `px-8`, so the right edge
|
||||
// anchors identically too.
|
||||
return (
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<div
|
||||
className={cn(
|
||||
'shrink-0 flex items-center gap-1 backdrop-blur-md shadow-sm rounded-full',
|
||||
'shrink-0 flex items-center gap-1 rounded-lg',
|
||||
compact
|
||||
? 'bg-zinc-100/70 dark:bg-zinc-800/70 border border-zinc-200/60 dark:border-zinc-700/60 px-1.5 py-1'
|
||||
: 'bg-white/60 dark:bg-gray-800/60 border border-gray-100/50 dark:border-gray-700/50 px-2 py-1.5',
|
||||
? 'bg-neutral-100/70 dark:bg-neutral-800/70 border border-neutral-200/60 dark:border-neutral-700/60 px-1.5 py-1'
|
||||
: 'bg-background border border-border px-2 py-1.5',
|
||||
)}
|
||||
>
|
||||
{/* Language — Radix DropdownMenu so its menu portals to body
|
||||
@ -155,7 +155,7 @@ export function HeaderControls({
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button
|
||||
className="p-2 rounded-full text-gray-400 dark:text-gray-500 hover:bg-white dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 hover:shadow-sm transition-all group"
|
||||
className="p-2 rounded-full text-neutral-400 dark:text-neutral-500 hover:bg-white dark:hover:bg-neutral-700 hover:text-neutral-800 dark:hover:text-neutral-200 hover:shadow-sm transition-all group"
|
||||
aria-label={t('settings.theme')}
|
||||
>
|
||||
{theme === 'light' && <Sun className="w-4 h-4" />}
|
||||
@ -169,7 +169,7 @@ export function HeaderControls({
|
||||
className={cn(
|
||||
'cursor-pointer gap-2',
|
||||
theme === 'light' &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400',
|
||||
'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-600 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
<Sun className="w-4 h-4" />
|
||||
@ -180,7 +180,7 @@ export function HeaderControls({
|
||||
className={cn(
|
||||
'cursor-pointer gap-2',
|
||||
theme === 'dark' &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400',
|
||||
'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-600 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
<Moon className="w-4 h-4" />
|
||||
@ -191,7 +191,7 @@ export function HeaderControls({
|
||||
className={cn(
|
||||
'cursor-pointer gap-2',
|
||||
theme === 'system' &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400',
|
||||
'bg-neutral-50 dark:bg-neutral-900/20 text-neutral-600 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
<Monitor className="w-4 h-4" />
|
||||
@ -203,7 +203,7 @@ export function HeaderControls({
|
||||
{/* Settings */}
|
||||
<button
|
||||
onClick={() => setSettingsOpen(true)}
|
||||
className="p-2 rounded-full text-gray-400 dark:text-gray-500 hover:bg-white dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 hover:shadow-sm transition-all group"
|
||||
className="p-2 rounded-full text-neutral-400 dark:text-neutral-500 hover:bg-white dark:hover:bg-neutral-700 hover:text-neutral-800 dark:hover:text-neutral-200 hover:shadow-sm transition-all group"
|
||||
aria-label={t('settings.title')}
|
||||
>
|
||||
<Settings className="w-4 h-4 group-hover:rotate-90 transition-transform duration-500" />
|
||||
@ -219,15 +219,13 @@ export function HeaderControls({
|
||||
{onToggleEditMode && (
|
||||
<label
|
||||
className={cn(
|
||||
'shrink-0 inline-flex items-center gap-2.5 rounded-full border shadow-sm transition-colors duration-200',
|
||||
'bg-white/60 dark:bg-gray-800/60 backdrop-blur-md',
|
||||
'shrink-0 inline-flex items-center gap-2.5 rounded-md border transition-colors duration-200',
|
||||
'bg-background',
|
||||
compact ? 'h-8 px-2.5' : 'h-9 px-3',
|
||||
proChecked
|
||||
? 'border-violet-500/60 dark:border-violet-400/60'
|
||||
: 'border-gray-100/50 dark:border-gray-700/50',
|
||||
proChecked ? 'border-neutral-500/60 dark:border-neutral-400/60' : 'border-border',
|
||||
!canEdit && mode !== 'edit'
|
||||
? 'opacity-60 cursor-not-allowed'
|
||||
: 'cursor-pointer hover:border-violet-400/60 dark:hover:border-violet-500/50',
|
||||
: 'cursor-pointer hover:border-neutral-400/60 dark:hover:border-neutral-500/50',
|
||||
)}
|
||||
// When disabled (e.g. the course-complete placeholder), explain why
|
||||
// on hover and point the user to a real scene instead of a bare
|
||||
@ -244,8 +242,8 @@ export function HeaderControls({
|
||||
className={cn(
|
||||
'text-[11px] font-bold uppercase tracking-[0.14em] tabular-nums select-none transition-colors duration-200',
|
||||
proChecked
|
||||
? 'text-violet-600 dark:text-violet-300'
|
||||
: 'text-gray-500 dark:text-gray-400',
|
||||
? 'text-neutral-600 dark:text-neutral-300'
|
||||
: 'text-neutral-500 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
{t('edit.proMode')}
|
||||
@ -255,7 +253,7 @@ export function HeaderControls({
|
||||
onCheckedChange={onToggleEditMode}
|
||||
disabled={!canEdit && mode !== 'edit'}
|
||||
aria-label={proChecked ? t('stage.doneEditing') : t('stage.editCourse')}
|
||||
className="data-[state=checked]:bg-violet-600 dark:data-[state=checked]:bg-violet-500"
|
||||
className="data-[state=checked]:bg-neutral-600 dark:data-[state=checked]:bg-neutral-500"
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
@ -276,8 +274,8 @@ export function HeaderControls({
|
||||
className={cn(
|
||||
'shrink-0 p-2 rounded-full transition-all',
|
||||
canExport && !isExporting && !isExportingZip && !isExportingScript
|
||||
? 'text-gray-400 dark:text-gray-500 hover:bg-white dark:hover:bg-gray-700 hover:text-gray-800 dark:hover:text-gray-200 hover:shadow-sm'
|
||||
: 'text-gray-300 dark:text-gray-600 cursor-not-allowed opacity-50',
|
||||
? 'text-neutral-400 dark:text-neutral-500 hover:bg-white dark:hover:bg-neutral-700 hover:text-neutral-800 dark:hover:text-neutral-200 hover:shadow-sm'
|
||||
: 'text-neutral-300 dark:text-neutral-600 cursor-not-allowed opacity-50',
|
||||
)}
|
||||
aria-label={exportLabel}
|
||||
>
|
||||
@ -299,7 +297,7 @@ export function HeaderControls({
|
||||
className="cursor-pointer gap-2.5"
|
||||
title={canExport ? undefined : t('export.mediaPending')}
|
||||
>
|
||||
<FileDown className="w-4 h-4 text-gray-400 shrink-0" />
|
||||
<FileDown className="w-4 h-4 text-neutral-400 shrink-0" />
|
||||
<span>{t('export.pptx')}</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
@ -308,10 +306,10 @@ export function HeaderControls({
|
||||
className="cursor-pointer gap-2.5"
|
||||
title={canExport ? undefined : t('export.mediaPending')}
|
||||
>
|
||||
<Package className="w-4 h-4 text-gray-400 shrink-0" />
|
||||
<Package className="w-4 h-4 text-neutral-400 shrink-0" />
|
||||
<div>
|
||||
<div>{t('export.resourcePack')}</div>
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500">
|
||||
<div className="text-[11px] text-neutral-400 dark:text-neutral-500">
|
||||
{t('export.resourcePackDesc')}
|
||||
</div>
|
||||
</div>
|
||||
@ -322,10 +320,10 @@ export function HeaderControls({
|
||||
className="cursor-pointer gap-2.5"
|
||||
title={canExport ? undefined : t('export.mediaPending')}
|
||||
>
|
||||
<Archive className="w-4 h-4 text-gray-400 shrink-0" />
|
||||
<Archive className="w-4 h-4 text-neutral-400 shrink-0" />
|
||||
<div>
|
||||
<div>{t('export.classroomZip')}</div>
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500">
|
||||
<div className="text-[11px] text-neutral-400 dark:text-neutral-500">
|
||||
{t('export.classroomZipDesc')}
|
||||
</div>
|
||||
</div>
|
||||
@ -336,7 +334,7 @@ export function HeaderControls({
|
||||
title={canExport ? undefined : t('export.mediaPending')}
|
||||
className="cursor-pointer gap-2.5"
|
||||
>
|
||||
<NotebookText className="w-4 h-4 text-gray-400 shrink-0" aria-hidden="true" />
|
||||
<NotebookText className="w-4 h-4 text-neutral-400 shrink-0" aria-hidden="true" />
|
||||
<span>{t('export.script')}</span>
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuSubContent className="min-w-[240px]">
|
||||
@ -345,10 +343,10 @@ export function HeaderControls({
|
||||
onSelect={exportScriptMd}
|
||||
className="cursor-pointer gap-2.5"
|
||||
>
|
||||
<NotebookText className="w-4 h-4 text-gray-400 shrink-0" aria-hidden="true" />
|
||||
<NotebookText className="w-4 h-4 text-neutral-400 shrink-0" aria-hidden="true" />
|
||||
<div>
|
||||
<div>{t('export.scriptMd')}</div>
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500">
|
||||
<div className="text-[11px] text-neutral-400 dark:text-neutral-500">
|
||||
{t('export.scriptMdDesc')}
|
||||
</div>
|
||||
</div>
|
||||
@ -359,12 +357,12 @@ export function HeaderControls({
|
||||
className="cursor-pointer gap-2.5"
|
||||
>
|
||||
<NotebookText
|
||||
className="w-4 h-4 text-gray-400 dark:text-gray-500"
|
||||
className="w-4 h-4 text-neutral-400 dark:text-neutral-500"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div>
|
||||
<div>{t('export.scriptDocx')}</div>
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500">
|
||||
<div className="text-[11px] text-neutral-400 dark:text-neutral-500">
|
||||
{t('export.scriptDocxDesc')}
|
||||
</div>
|
||||
</div>
|
||||
@ -375,13 +373,13 @@ export function HeaderControls({
|
||||
<DropdownMenuItem
|
||||
disabled={!canExport}
|
||||
onSelect={() => setVideoDialogOpen(true)}
|
||||
className="cursor-pointer gap-2.5 border-t border-gray-200 dark:border-gray-700"
|
||||
className="cursor-pointer gap-2.5 border-t border-neutral-200 dark:border-neutral-700"
|
||||
title={canExport ? undefined : t('export.mediaPending')}
|
||||
>
|
||||
<Film className="w-4 h-4 text-gray-400 shrink-0" />
|
||||
<Film className="w-4 h-4 text-neutral-400 shrink-0" />
|
||||
<div>
|
||||
<div>{t('export.video')}</div>
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500">
|
||||
<div className="text-[11px] text-neutral-400 dark:text-neutral-500">
|
||||
{t('export.videoDesc')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { BrandLogo } from '@/components/brand-logo';
|
||||
import { useState, useRef, useCallback } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import {
|
||||
@ -30,7 +31,7 @@ interface SceneSidebarProps {
|
||||
readonly isCourseComplete?: boolean;
|
||||
}
|
||||
|
||||
const DEFAULT_WIDTH = 220;
|
||||
const DEFAULT_WIDTH = 240;
|
||||
const MIN_WIDTH = 170;
|
||||
const MAX_WIDTH = 400;
|
||||
|
||||
@ -111,15 +112,15 @@ export function SceneSidebar({
|
||||
width: displayWidth,
|
||||
transition: isDraggingRef.current ? 'none' : 'width 0.3s ease',
|
||||
}}
|
||||
className="bg-white/80 dark:bg-slate-900/80 backdrop-blur-xl border-r border-gray-100 dark:border-gray-800 shadow-[2px_0_24px_rgba(0,0,0,0.02)] flex flex-col shrink-0 z-20 relative overflow-visible"
|
||||
className="bg-sidebar border-r border-border flex flex-col shrink-0 z-20 relative overflow-visible"
|
||||
>
|
||||
{/* Drag handle */}
|
||||
{!collapsed && (
|
||||
<div
|
||||
onMouseDown={handleDragStart}
|
||||
className="absolute right-0 top-0 bottom-0 w-1.5 cursor-col-resize z-50 group hover:bg-purple-400/30 dark:hover:bg-purple-600/30 active:bg-purple-500/40 dark:active:bg-purple-500/40 transition-colors"
|
||||
className="absolute right-0 top-0 bottom-0 w-1.5 cursor-col-resize z-50 group hover:bg-neutral-400/30 dark:hover:bg-neutral-600/30 active:bg-neutral-500/40 dark:active:bg-neutral-500/40 transition-colors"
|
||||
>
|
||||
<div className="absolute right-0.5 top-1/2 -translate-y-1/2 w-0.5 h-8 rounded-full bg-gray-300 dark:bg-gray-600 group-hover:bg-purple-400 dark:group-hover:bg-purple-500 transition-colors" />
|
||||
<div className="absolute right-0.5 top-1/2 -translate-y-1/2 w-0.5 h-8 rounded-full bg-neutral-300 dark:bg-neutral-600 group-hover:bg-neutral-400 dark:group-hover:bg-neutral-500 transition-colors" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@ -128,14 +129,14 @@ export function SceneSidebar({
|
||||
<div className="h-10 flex items-center justify-between shrink-0 relative mt-3 mb-1 px-3">
|
||||
<button
|
||||
onClick={() => router.push('/')}
|
||||
className="flex items-center gap-2 cursor-pointer rounded-lg px-1.5 -mx-1.5 py-1 -my-1 hover:bg-gray-100/80 dark:hover:bg-gray-800/60 active:scale-[0.97] transition-all duration-150"
|
||||
className="flex items-center gap-2 cursor-pointer rounded-lg px-1.5 -mx-1.5 py-1 -my-1 hover:bg-neutral-100/80 dark:hover:bg-neutral-800/60 active:scale-[0.97] transition-all duration-150"
|
||||
title={t('generation.backToHome')}
|
||||
>
|
||||
<img src="/logo-horizontal.png" alt="OpenMAIC" className="h-6" />
|
||||
<BrandLogo />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => onCollapseChange(true)}
|
||||
className="w-7 h-7 shrink-0 rounded-lg flex items-center justify-center bg-gray-100/80 dark:bg-gray-800/80 text-gray-500 dark:text-gray-400 ring-1 ring-black/[0.04] dark:ring-white/[0.06] hover:bg-gray-200/90 dark:hover:bg-gray-700/90 hover:text-gray-700 dark:hover:text-gray-200 active:scale-90 transition-all duration-200"
|
||||
className="w-7 h-7 shrink-0 rounded-lg flex items-center justify-center bg-neutral-100/80 dark:bg-neutral-800/80 text-neutral-500 dark:text-neutral-400 ring-1 ring-black/[0.04] dark:ring-white/[0.06] hover:bg-neutral-200/90 dark:hover:bg-neutral-700/90 hover:text-neutral-700 dark:hover:text-neutral-200 active:scale-90 transition-all duration-200"
|
||||
>
|
||||
<PanelLeftClose className="w-4 h-4" />
|
||||
</button>
|
||||
@ -168,8 +169,8 @@ export function SceneSidebar({
|
||||
className={cn(
|
||||
'group relative rounded-lg transition-all duration-200 cursor-pointer flex flex-col gap-1 p-1.5',
|
||||
isActive
|
||||
? 'bg-purple-50 dark:bg-purple-900/20 ring-1 ring-purple-200 dark:ring-purple-700'
|
||||
: 'hover:bg-gray-50/80 dark:hover:bg-gray-800/50',
|
||||
? 'bg-accent/50 ring-1 ring-border border-l-2 border-l-brand'
|
||||
: 'hover:bg-neutral-50/80 dark:hover:bg-neutral-800/50',
|
||||
)}
|
||||
>
|
||||
{/* Scene Header */}
|
||||
@ -179,8 +180,8 @@ export function SceneSidebar({
|
||||
className={cn(
|
||||
'text-[10px] font-black w-4 h-4 rounded-full flex items-center justify-center shrink-0',
|
||||
isActive
|
||||
? 'bg-purple-600 dark:bg-purple-500 text-white shadow-sm shadow-purple-500/30'
|
||||
: 'bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400',
|
||||
? 'bg-neutral-600 dark:bg-neutral-500 text-white shadow-sm shadow-neutral-500/30'
|
||||
: 'bg-neutral-100 dark:bg-neutral-700 text-neutral-500 dark:text-neutral-400',
|
||||
)}
|
||||
>
|
||||
{index + 1}
|
||||
@ -190,8 +191,8 @@ export function SceneSidebar({
|
||||
className={cn(
|
||||
'text-xs font-bold truncate transition-colors',
|
||||
isActive
|
||||
? 'text-purple-700 dark:text-purple-300'
|
||||
: 'text-gray-600 dark:text-gray-300 group-hover:text-gray-900 dark:group-hover:text-gray-100',
|
||||
? 'text-neutral-700 dark:text-neutral-300'
|
||||
: 'text-neutral-600 dark:text-neutral-300 group-hover:text-neutral-900 dark:group-hover:text-neutral-100',
|
||||
)}
|
||||
>
|
||||
{scene.title}
|
||||
@ -200,7 +201,7 @@ export function SceneSidebar({
|
||||
</div>
|
||||
|
||||
{/* Thumbnail */}
|
||||
<div className="relative aspect-video w-full rounded overflow-hidden bg-gray-100 dark:bg-gray-800 ring-1 ring-black/5 dark:ring-white/5">
|
||||
<div className="relative aspect-video w-full rounded overflow-hidden bg-neutral-100 dark:bg-neutral-800 ring-1 ring-black/5 dark:ring-white/5">
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
{isSlide && slideContent ? (
|
||||
<LazySlideThumbnail
|
||||
@ -313,7 +314,7 @@ export function SceneSidebar({
|
||||
</div>
|
||||
) : (
|
||||
/* Fallback */
|
||||
<div className="w-full h-full flex flex-col items-center justify-center gap-1 bg-gray-50 dark:bg-gray-800 text-gray-300 dark:text-gray-500">
|
||||
<div className="w-full h-full flex flex-col items-center justify-center gap-1 bg-neutral-50 dark:bg-neutral-800 text-neutral-300 dark:text-neutral-500">
|
||||
<Icon className="w-4 h-4" />
|
||||
<span className="text-[9px] font-bold uppercase tracking-wider opacity-80">
|
||||
{scene.type}
|
||||
@ -324,9 +325,9 @@ export function SceneSidebar({
|
||||
{isSlide && (
|
||||
<div
|
||||
className={cn(
|
||||
'absolute inset-0 bg-purple-500/0 transition-colors',
|
||||
'absolute inset-0 bg-neutral-500/0 transition-colors',
|
||||
isActive
|
||||
? 'bg-purple-500/0'
|
||||
? 'bg-neutral-500/0'
|
||||
: 'group-hover:bg-black/5 dark:group-hover:bg-white/5',
|
||||
)}
|
||||
/>
|
||||
@ -361,11 +362,11 @@ export function SceneSidebar({
|
||||
'group relative rounded-lg flex flex-col gap-1 p-1.5 transition-all duration-200',
|
||||
isFailed
|
||||
? 'opacity-100 cursor-default'
|
||||
: 'cursor-pointer hover:bg-gray-50/80 dark:hover:bg-gray-800/50',
|
||||
: 'cursor-pointer hover:bg-neutral-50/80 dark:hover:bg-neutral-800/50',
|
||||
!isFailed && !isActive && 'opacity-60',
|
||||
isActive &&
|
||||
!isFailed &&
|
||||
'bg-purple-50 dark:bg-purple-900/20 ring-1 ring-purple-200 dark:ring-purple-700 opacity-100',
|
||||
'bg-accent/50 ring-1 ring-border border-l-2 border-l-brand opacity-100',
|
||||
)}
|
||||
>
|
||||
{/* Scene Header */}
|
||||
@ -375,8 +376,8 @@ export function SceneSidebar({
|
||||
className={cn(
|
||||
'text-[10px] font-black w-4 h-4 rounded-full flex items-center justify-center shrink-0',
|
||||
isActive && !isFailed
|
||||
? 'bg-purple-600 dark:bg-purple-500 text-white shadow-sm shadow-purple-500/30'
|
||||
: 'bg-gray-100 dark:bg-gray-700 text-gray-400 dark:text-gray-500',
|
||||
? 'bg-neutral-600 dark:bg-neutral-500 text-white shadow-sm shadow-neutral-500/30'
|
||||
: 'bg-neutral-100 dark:bg-neutral-700 text-neutral-400 dark:text-neutral-500',
|
||||
)}
|
||||
>
|
||||
{scenes.length + 1}
|
||||
@ -385,10 +386,10 @@ export function SceneSidebar({
|
||||
className={cn(
|
||||
'text-xs font-bold truncate transition-colors',
|
||||
isActive && !isFailed
|
||||
? 'text-purple-700 dark:text-purple-300'
|
||||
? 'text-neutral-700 dark:text-neutral-300'
|
||||
: isFailed
|
||||
? 'text-gray-700 dark:text-gray-200'
|
||||
: 'text-gray-400 dark:text-gray-500',
|
||||
? 'text-neutral-700 dark:text-neutral-200'
|
||||
: 'text-neutral-400 dark:text-neutral-500',
|
||||
)}
|
||||
>
|
||||
{outline.title}
|
||||
@ -402,7 +403,7 @@ export function SceneSidebar({
|
||||
'relative aspect-video w-full rounded overflow-hidden ring-1',
|
||||
isFailed
|
||||
? 'bg-red-50/30 dark:bg-red-950/10 ring-red-100 dark:ring-red-900/20'
|
||||
: 'bg-gray-100 dark:bg-gray-800 ring-black/5 dark:ring-white/5',
|
||||
: 'bg-neutral-100 dark:bg-neutral-800 ring-black/5 dark:ring-white/5',
|
||||
)}
|
||||
>
|
||||
<div className="absolute inset-0 flex flex-col items-center justify-center gap-1.5">
|
||||
@ -435,17 +436,17 @@ export function SceneSidebar({
|
||||
<>
|
||||
<div
|
||||
className={cn(
|
||||
'h-2 w-3/5 bg-gray-200 dark:bg-gray-700 rounded',
|
||||
'h-2 w-3/5 bg-neutral-200 dark:bg-neutral-700 rounded',
|
||||
!isPaused && 'animate-pulse',
|
||||
)}
|
||||
/>
|
||||
<div
|
||||
className={cn(
|
||||
'h-1.5 w-2/5 bg-gray-200 dark:bg-gray-700 rounded',
|
||||
'h-1.5 w-2/5 bg-neutral-200 dark:bg-neutral-700 rounded',
|
||||
!isPaused && 'animate-pulse',
|
||||
)}
|
||||
/>
|
||||
<span className="text-[9px] font-medium text-gray-400 dark:text-gray-500 mt-0.5">
|
||||
<span className="text-[9px] font-medium text-neutral-400 dark:text-neutral-500 mt-0.5">
|
||||
{isPaused ? t('stage.paused') : t('stage.generating')}
|
||||
</span>
|
||||
</>
|
||||
|
||||
@ -168,7 +168,7 @@ export function SceneThumbnailContent({
|
||||
// scene type is loaded by an older client.
|
||||
const unknownType = (scene as { type: string }).type;
|
||||
return (
|
||||
<div className="flex h-full w-full flex-col items-center justify-center gap-1 bg-gray-50 text-gray-300 dark:bg-gray-800 dark:text-gray-500">
|
||||
<div className="flex h-full w-full flex-col items-center justify-center gap-1 bg-neutral-50 text-neutral-300 dark:bg-neutral-800 dark:text-neutral-500">
|
||||
<BookOpen className="h-4 w-4" />
|
||||
<span className="text-[9px] font-bold uppercase tracking-wider opacity-80">
|
||||
{unknownType}
|
||||
|
||||
@ -71,7 +71,7 @@ function OptionRow<T extends string | number>({
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500 mb-1">{label}</div>
|
||||
<div className="text-[11px] text-neutral-400 dark:text-neutral-500 mb-1">{label}</div>
|
||||
<div className="flex gap-1.5">
|
||||
{options.map((opt) => (
|
||||
<button
|
||||
@ -82,7 +82,7 @@ function OptionRow<T extends string | number>({
|
||||
'flex-1 px-2 py-1.5 text-xs rounded-md border transition-colors disabled:opacity-50',
|
||||
opt === value
|
||||
? 'border-primary bg-primary/10 text-primary'
|
||||
: 'border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700',
|
||||
: 'border-neutral-200 dark:border-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-700',
|
||||
)}
|
||||
>
|
||||
{format ? format(opt) : String(opt)}
|
||||
@ -133,7 +133,7 @@ export function VideoExportDialog({
|
||||
<DialogContent className="max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<Film className="w-4 h-4 text-gray-400 shrink-0" />
|
||||
<Film className="w-4 h-4 text-neutral-400 shrink-0" />
|
||||
{t('export.video')}
|
||||
</DialogTitle>
|
||||
<DialogDescription>{t('export.videoDesc')}</DialogDescription>
|
||||
@ -170,11 +170,11 @@ export function VideoExportDialog({
|
||||
)}
|
||||
|
||||
{/* Subtitles */}
|
||||
<div className="border-t border-gray-200 dark:border-gray-700 pt-3 flex flex-col gap-2">
|
||||
<div className="border-t border-neutral-200 dark:border-neutral-700 pt-3 flex flex-col gap-2">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div>
|
||||
<div className="text-sm">{t('export.videoBurnSubtitles')}</div>
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500">
|
||||
<div className="text-[11px] text-neutral-400 dark:text-neutral-500">
|
||||
{t('export.videoBurnSubtitlesDesc')}
|
||||
</div>
|
||||
</div>
|
||||
@ -187,7 +187,7 @@ export function VideoExportDialog({
|
||||
<button
|
||||
onClick={() => downloadSubtitles('srt')}
|
||||
disabled={busy || downloading}
|
||||
className="w-full px-2 py-1.5 text-xs rounded-md border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 flex items-center justify-center gap-1.5"
|
||||
className="w-full px-2 py-1.5 text-xs rounded-md border border-neutral-200 dark:border-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-700 transition-colors disabled:opacity-50 flex items-center justify-center gap-1.5"
|
||||
>
|
||||
{downloading ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
@ -202,7 +202,7 @@ export function VideoExportDialog({
|
||||
{rendering && (
|
||||
<div>
|
||||
<Progress value={percent} />
|
||||
<div className="mt-1 text-[11px] text-gray-400 dark:text-gray-500">
|
||||
<div className="mt-1 text-[11px] text-neutral-400 dark:text-neutral-500">
|
||||
{etaMs != null
|
||||
? t('export.videoProgressWithEta', {
|
||||
percent,
|
||||
@ -214,7 +214,7 @@ export function VideoExportDialog({
|
||||
)}
|
||||
|
||||
{/* Actions */}
|
||||
<div className="border-t border-gray-200 dark:border-gray-700 pt-3 flex flex-col gap-1.5">
|
||||
<div className="border-t border-neutral-200 dark:border-neutral-700 pt-3 flex flex-col gap-1.5">
|
||||
{serviceEnabled && (
|
||||
<button
|
||||
onClick={() => renderVideo()}
|
||||
@ -228,13 +228,13 @@ export function VideoExportDialog({
|
||||
<button
|
||||
onClick={() => exportVideo(resolution, burnInSubtitles)}
|
||||
disabled={busy}
|
||||
className="w-full px-2 py-2 text-sm rounded-md border border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors disabled:opacity-50 flex items-center justify-center gap-1.5"
|
||||
className="w-full px-2 py-2 text-sm rounded-md border border-neutral-200 dark:border-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-700 transition-colors disabled:opacity-50 flex items-center justify-center gap-1.5"
|
||||
>
|
||||
{isExportingVideo && <Loader2 className="w-3.5 h-3.5 animate-spin" />}
|
||||
{t('export.videoDownloadZip')}
|
||||
</button>
|
||||
{serviceEnabled === false && (
|
||||
<div className="text-[11px] text-gray-400 dark:text-gray-500">
|
||||
<div className="text-[11px] text-neutral-400 dark:text-neutral-500">
|
||||
{t('export.videoServiceHint')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@ -5,13 +5,13 @@ import { Slot } from 'radix-ui';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const buttonVariants = cva(
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-1 aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary text-primary-foreground hover:bg-primary/80',
|
||||
outline:
|
||||
'border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs',
|
||||
'border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-none',
|
||||
secondary:
|
||||
'bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
|
||||
ghost:
|
||||
|
||||
@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
||||
'dark:bg-field border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 rounded-md border bg-field px-2.5 py-1 text-base shadow-none transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-1 aria-invalid:ring-[3px] md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@ -37,7 +37,7 @@ function SelectTrigger({
|
||||
data-slot="select-trigger"
|
||||
data-size={size}
|
||||
className={cn(
|
||||
"border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border bg-transparent py-2 pr-2 pl-2.5 text-sm shadow-xs transition-[color,box-shadow] focus-visible:ring-[3px] aria-invalid:ring-[3px] data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
"border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border bg-transparent py-2 pr-2 pl-2.5 text-sm shadow-none transition-[color,box-shadow] focus-visible:ring-1 aria-invalid:ring-[3px] data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@ -7,7 +7,7 @@ function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
|
||||
<textarea
|
||||
data-slot="textarea"
|
||||
className={cn(
|
||||
'border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
||||
'border-input dark:bg-field focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border bg-field px-2.5 py-2 text-base shadow-none transition-[color,box-shadow] focus-visible:ring-1 aria-invalid:ring-[3px] md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@ -89,7 +89,7 @@ export function UserProfileCard() {
|
||||
|
||||
if (!hydrated) {
|
||||
return (
|
||||
<Card className="p-5 !gap-0 shadow-xl border-muted/40 backdrop-blur-xl bg-white/80 dark:bg-slate-900/80">
|
||||
<Card className="p-5 !gap-0 shadow-xl border-muted/40 backdrop-blur-xl bg-white/80 dark:bg-neutral-900/80">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="size-11 rounded-full bg-muted animate-pulse" />
|
||||
<div className="flex-1 space-y-2">
|
||||
@ -102,7 +102,7 @@ export function UserProfileCard() {
|
||||
}
|
||||
|
||||
return (
|
||||
<Card className="p-5 !gap-0 shadow-xl border-muted/40 backdrop-blur-xl bg-white/80 dark:bg-slate-900/80">
|
||||
<Card className="p-5 !gap-0 shadow-xl border-muted/40 backdrop-blur-xl bg-white/80 dark:bg-neutral-900/80">
|
||||
{/* File input — sr-only keeps it in the flow but invisible; label triggers it */}
|
||||
<input
|
||||
id={FILE_INPUT_ID}
|
||||
@ -119,10 +119,10 @@ export function UserProfileCard() {
|
||||
onClick={() => setAvatarPickerOpen(!avatarPickerOpen)}
|
||||
className="shrink-0 group/avatar relative cursor-pointer"
|
||||
>
|
||||
<div className="size-11 rounded-full bg-gray-50 dark:bg-gray-800 overflow-hidden ring-2 ring-violet-300/50 dark:ring-violet-600/40 group-hover/avatar:ring-violet-400 dark:group-hover/avatar:ring-violet-500 transition-all">
|
||||
<div className="size-11 rounded-full bg-neutral-50 dark:bg-neutral-800 overflow-hidden ring-2 ring-neutral-300/50 dark:ring-neutral-600/40 group-hover/avatar:ring-neutral-400 dark:group-hover/avatar:ring-neutral-500 transition-all">
|
||||
<img src={avatar} alt="" className="size-full object-cover" />
|
||||
</div>
|
||||
<div className="absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-white dark:bg-slate-800 border border-muted/60 flex items-center justify-center">
|
||||
<div className="absolute -bottom-0.5 -right-0.5 size-4 rounded-full bg-white dark:bg-neutral-800 border border-muted/60 flex items-center justify-center">
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
'size-2.5 text-muted-foreground transition-transform duration-200',
|
||||
@ -147,11 +147,11 @@ export function UserProfileCard() {
|
||||
onBlur={commitName}
|
||||
maxLength={20}
|
||||
placeholder={t('profile.defaultNickname')}
|
||||
className="flex-1 min-w-0 h-7 bg-transparent border-b-2 border-violet-400 dark:border-violet-500 text-sm font-semibold text-foreground outline-none placeholder:text-muted-foreground/40"
|
||||
className="flex-1 min-w-0 h-7 bg-transparent border-b-2 border-neutral-400 dark:border-neutral-500 text-sm font-semibold text-foreground outline-none placeholder:text-muted-foreground/40"
|
||||
/>
|
||||
<button
|
||||
onClick={commitName}
|
||||
className="shrink-0 size-6 rounded-md flex items-center justify-center text-violet-500 hover:bg-violet-100 dark:hover:bg-violet-900/30 transition-colors"
|
||||
className="shrink-0 size-6 rounded-md flex items-center justify-center text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-900/30 transition-colors"
|
||||
>
|
||||
<Check className="size-3.5" />
|
||||
</button>
|
||||
@ -186,10 +186,10 @@ export function UserProfileCard() {
|
||||
key={url}
|
||||
onClick={() => setAvatar(url)}
|
||||
className={cn(
|
||||
'size-8 rounded-full overflow-hidden bg-gray-50 dark:bg-gray-800 cursor-pointer transition-all duration-150',
|
||||
'size-8 rounded-full overflow-hidden bg-neutral-50 dark:bg-neutral-800 cursor-pointer transition-all duration-150',
|
||||
'hover:scale-110 active:scale-95',
|
||||
avatar === url
|
||||
? 'ring-2 ring-violet-400 dark:ring-violet-500 ring-offset-1 ring-offset-white dark:ring-offset-slate-900'
|
||||
? 'ring-2 ring-neutral-400 dark:ring-neutral-500 ring-offset-1 ring-offset-white dark:ring-offset-neutral-900'
|
||||
: 'hover:ring-1 hover:ring-muted-foreground/30',
|
||||
)}
|
||||
>
|
||||
@ -204,7 +204,7 @@ export function UserProfileCard() {
|
||||
'size-8 rounded-full flex items-center justify-center cursor-pointer transition-all duration-150 border border-dashed',
|
||||
'hover:scale-110 active:scale-95',
|
||||
isCustomAvatar(avatar)
|
||||
? 'ring-2 ring-violet-400 dark:ring-violet-500 ring-offset-1 ring-offset-white dark:ring-offset-slate-900 border-violet-300 dark:border-violet-600 bg-violet-50 dark:bg-violet-900/30'
|
||||
? 'ring-2 ring-neutral-400 dark:ring-neutral-500 ring-offset-1 ring-offset-white dark:ring-offset-neutral-900 border-neutral-300 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-900/30'
|
||||
: 'border-muted-foreground/30 text-muted-foreground/50 hover:border-muted-foreground/50',
|
||||
)}
|
||||
title={t('profile.uploadAvatar')}
|
||||
|
||||
@ -117,15 +117,15 @@ export function Whiteboard({ isOpen, onClose }: WhiteboardProps) {
|
||||
y: 16,
|
||||
transition: { duration: 0.5, ease: [0.4, 0, 0.2, 1] },
|
||||
}}
|
||||
className="absolute inset-4 pointer-events-auto bg-white/95 dark:bg-gray-800/95 backdrop-blur-2xl rounded-3xl shadow-[0_32px_80px_-20px_rgba(0,0,0,0.25)] border-2 border-purple-200/60 dark:border-purple-700/60 flex flex-col overflow-hidden z-[120] ring-4 ring-purple-100/40 dark:ring-purple-800/40"
|
||||
className="absolute inset-4 pointer-events-auto bg-white/95 dark:bg-neutral-800/95 backdrop-blur-2xl rounded-3xl shadow-[0_32px_80px_-20px_rgba(0,0,0,0.25)] border-2 border-neutral-200/60 dark:border-neutral-700/60 flex flex-col overflow-hidden z-[120] ring-4 ring-neutral-100/40 dark:ring-neutral-800/40"
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="h-14 px-6 border-b border-gray-100 dark:border-gray-700 flex items-center justify-between shrink-0 bg-white/50 dark:bg-gray-800/50">
|
||||
<div className="h-14 px-6 border-b border-neutral-100 dark:border-neutral-700 flex items-center justify-between shrink-0 bg-white/50 dark:bg-neutral-800/50">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-8 h-8 rounded-xl bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center text-purple-600 dark:text-purple-400">
|
||||
<div className="w-8 h-8 rounded-xl bg-neutral-100 dark:bg-neutral-900/30 flex items-center justify-center text-neutral-600 dark:text-neutral-400">
|
||||
<PencilLine className="w-4 h-4" />
|
||||
</div>
|
||||
<span className="font-bold text-gray-800 dark:text-gray-200 tracking-tight">
|
||||
<span className="font-bold text-neutral-800 dark:text-neutral-200 tracking-tight">
|
||||
{t('whiteboard.title')}
|
||||
</span>
|
||||
</div>
|
||||
@ -141,7 +141,7 @@ export function Whiteboard({ isOpen, onClose }: WhiteboardProps) {
|
||||
transition={{ duration: 0.15 }}
|
||||
onClick={() => canvasRef.current?.resetView()}
|
||||
whileTap={{ scale: 0.9 }}
|
||||
className="p-2 text-gray-400 dark:text-gray-500 hover:text-purple-500 dark:hover:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded-lg transition-colors"
|
||||
className="p-2 text-neutral-400 dark:text-neutral-500 hover:text-neutral-500 dark:hover:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-900/20 rounded-lg transition-colors"
|
||||
title={t('whiteboard.resetView')}
|
||||
>
|
||||
<RotateCcw className="w-4 h-4" />
|
||||
@ -155,7 +155,7 @@ export function Whiteboard({ isOpen, onClose }: WhiteboardProps) {
|
||||
onClick={handleClear}
|
||||
disabled={isClearing || elementCount === 0}
|
||||
whileTap={{ scale: 0.9 }}
|
||||
className="p-2 text-gray-400 dark:text-gray-500 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-40 disabled:pointer-events-none"
|
||||
className="p-2 text-neutral-400 dark:text-neutral-500 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors disabled:opacity-40 disabled:pointer-events-none"
|
||||
title={t('whiteboard.clear')}
|
||||
>
|
||||
<motion.div
|
||||
@ -172,12 +172,12 @@ export function Whiteboard({ isOpen, onClose }: WhiteboardProps) {
|
||||
type="button"
|
||||
onClick={() => setHistoryOpen(!historyOpen)}
|
||||
whileTap={{ scale: 0.9 }}
|
||||
className="relative p-2 text-gray-400 dark:text-gray-500 hover:text-purple-500 dark:hover:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded-lg transition-colors"
|
||||
className="relative p-2 text-neutral-400 dark:text-neutral-500 hover:text-neutral-500 dark:hover:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-900/20 rounded-lg transition-colors"
|
||||
title={t('whiteboard.history')}
|
||||
>
|
||||
<History className="w-4 h-4" />
|
||||
{snapshotCount > 0 && (
|
||||
<span className="absolute -top-0.5 -right-0.5 min-w-[16px] h-4 px-1 rounded-full bg-purple-500 text-white text-[10px] font-bold flex items-center justify-center">
|
||||
<span className="absolute -top-0.5 -right-0.5 min-w-[16px] h-4 px-1 rounded-full bg-neutral-500 text-white text-[10px] font-bold flex items-center justify-center">
|
||||
{snapshotCount}
|
||||
</span>
|
||||
)}
|
||||
@ -189,11 +189,11 @@ export function Whiteboard({ isOpen, onClose }: WhiteboardProps) {
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<div className="w-px h-4 bg-gray-200 dark:bg-gray-700 mx-1" />
|
||||
<div className="w-px h-4 bg-neutral-200 dark:bg-neutral-700 mx-1" />
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="p-2 text-gray-400 dark:text-gray-500 hover:text-gray-800 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors"
|
||||
className="p-2 text-neutral-400 dark:text-neutral-500 hover:text-neutral-800 dark:hover:text-neutral-200 hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded-lg transition-colors"
|
||||
title={t('whiteboard.minimize')}
|
||||
>
|
||||
<Minimize2 className="w-5 h-5" />
|
||||
|
||||
@ -331,7 +331,7 @@ const InteractiveWhiteboardCanvas = forwardRef<
|
||||
>
|
||||
{/* Bounded canvas — white background, positioned and scaled. No overflow-hidden so elements can spill into transparent space. */}
|
||||
<div
|
||||
className="absolute bg-white shadow-2xl rounded-lg border border-gray-200 dark:border-gray-600"
|
||||
className="absolute bg-white shadow-2xl rounded-lg border border-neutral-200 dark:border-neutral-600"
|
||||
style={{
|
||||
width: canvasWidth,
|
||||
height: canvasHeight,
|
||||
@ -355,7 +355,7 @@ const InteractiveWhiteboardCanvas = forwardRef<
|
||||
exit={{ opacity: 0, transition: { duration: 0.15 } }}
|
||||
className="absolute inset-0 flex items-center justify-center"
|
||||
>
|
||||
<div className="text-center text-gray-400">
|
||||
<div className="text-center text-neutral-400">
|
||||
<p className="text-lg font-medium">{readyText}</p>
|
||||
<p className="text-sm mt-1">{readyHintText}</p>
|
||||
</div>
|
||||
|
||||
@ -109,14 +109,14 @@ export function WhiteboardHistory({ isOpen, onClose }: WhiteboardHistoryProps) {
|
||||
animate={{ opacity: 1, y: 0, scale: 1 }}
|
||||
exit={{ opacity: 0, y: -8, scale: 0.95 }}
|
||||
transition={{ duration: 0.15 }}
|
||||
className="absolute right-0 top-full mt-2 z-[130] w-72 max-h-80 bg-white dark:bg-gray-800 rounded-xl shadow-2xl border border-gray-200 dark:border-gray-700 overflow-hidden flex flex-col"
|
||||
className="absolute right-0 top-full mt-2 z-[130] w-72 max-h-80 bg-white dark:bg-neutral-800 rounded-xl shadow-2xl border border-neutral-200 dark:border-neutral-700 overflow-hidden flex flex-col"
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="px-4 py-3 border-b border-gray-100 dark:border-gray-700 flex items-center justify-between">
|
||||
<span className="text-sm font-semibold text-gray-700 dark:text-gray-200">
|
||||
<div className="px-4 py-3 border-b border-neutral-100 dark:border-neutral-700 flex items-center justify-between">
|
||||
<span className="text-sm font-semibold text-neutral-700 dark:text-neutral-200">
|
||||
{t('whiteboard.history')}
|
||||
</span>
|
||||
<span className="text-xs text-gray-400">
|
||||
<span className="text-xs text-neutral-400">
|
||||
{snapshots.length > 0 ? `${snapshots.length}` : ''}
|
||||
</span>
|
||||
</div>
|
||||
@ -124,7 +124,7 @@ export function WhiteboardHistory({ isOpen, onClose }: WhiteboardHistoryProps) {
|
||||
{/* Snapshot list */}
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
{snapshots.length === 0 ? (
|
||||
<div className="px-4 py-8 text-center text-sm text-gray-400 dark:text-gray-500">
|
||||
<div className="px-4 py-8 text-center text-sm text-neutral-400 dark:text-neutral-500">
|
||||
{t('whiteboard.noHistory')}
|
||||
</div>
|
||||
) : (
|
||||
@ -134,13 +134,13 @@ export function WhiteboardHistory({ isOpen, onClose }: WhiteboardHistoryProps) {
|
||||
return (
|
||||
<div
|
||||
key={`${snap.timestamp}-${realIdx}`}
|
||||
className="px-4 py-2.5 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors group"
|
||||
className="px-4 py-2.5 flex items-center justify-between hover:bg-neutral-50 dark:hover:bg-neutral-700/50 transition-colors group"
|
||||
>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="text-sm font-medium text-gray-700 dark:text-gray-200 truncate">
|
||||
<div className="text-sm font-medium text-neutral-700 dark:text-neutral-200 truncate">
|
||||
{`#${realIdx + 1}`}
|
||||
</div>
|
||||
<div className="text-xs text-gray-400 dark:text-gray-500 mt-0.5">
|
||||
<div className="text-xs text-neutral-400 dark:text-neutral-500 mt-0.5">
|
||||
{formatTime(snap.timestamp)} ·{' '}
|
||||
{t('whiteboard.elementCount', { count: snap.elements.length })}
|
||||
</div>
|
||||
@ -149,7 +149,7 @@ export function WhiteboardHistory({ isOpen, onClose }: WhiteboardHistoryProps) {
|
||||
type="button"
|
||||
onClick={() => handleRestore(realIdx)}
|
||||
disabled={isClearing}
|
||||
className="ml-2 px-2 py-1 text-xs text-purple-600 dark:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded-md opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent"
|
||||
className="ml-2 px-2 py-1 text-xs text-neutral-600 dark:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-900/20 rounded-md opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1 disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent"
|
||||
>
|
||||
<RotateCcw className="w-3 h-3" />
|
||||
{t('whiteboard.restore')}
|
||||
|
||||
@ -51,15 +51,15 @@ export function ProBadge({ active, onToggle, className, testId }: ProBadgeProps)
|
||||
interactive ? 'cursor-pointer' : 'cursor-default',
|
||||
active
|
||||
? [
|
||||
'border-violet-500/70 bg-violet-600 text-white',
|
||||
'shadow-[0_0_0_3px_rgba(139,92,246,0.14),0_1px_6px_rgba(109,40,217,0.35)]',
|
||||
'dark:border-violet-400/60 dark:bg-violet-500',
|
||||
'border-neutral-500/70 bg-neutral-600 text-white',
|
||||
'shadow-none',
|
||||
'dark:border-neutral-400/60 dark:bg-neutral-500',
|
||||
]
|
||||
: [
|
||||
'border-border bg-background/70 text-muted-foreground',
|
||||
'hover:border-violet-400/70 hover:bg-violet-50/60 hover:text-violet-600',
|
||||
'dark:hover:bg-violet-500/10',
|
||||
'dark:hover:border-violet-400/40 dark:hover:text-violet-300',
|
||||
'hover:border-neutral-400/70 hover:bg-neutral-50/60 hover:text-neutral-600',
|
||||
'dark:hover:bg-neutral-500/10',
|
||||
'dark:hover:border-neutral-400/40 dark:hover:text-neutral-300',
|
||||
],
|
||||
className,
|
||||
)}
|
||||
|
||||
@ -1,240 +1,41 @@
|
||||
/**
|
||||
* The Pro workspace's visual layer.
|
||||
*
|
||||
* Scoped under `.ws-root` and imported only by `WorkspaceShell.tsx`, so `/`
|
||||
* never receives a byte of it. Nothing here changes behaviour: every rule is
|
||||
* colour, type, light, shadow or motion.
|
||||
*
|
||||
* INHERITANCE IS THE BRIEF. This is the Pro surface of OpenMAIC, not a second
|
||||
* brand, so the vocabulary is lifted from what the product already uses:
|
||||
*
|
||||
* - the canvas is the homepage's own `slate-50 → slate-100` gradient, not
|
||||
* the flat `bg-white` v2 shipped (the flat white was the departure);
|
||||
* - the composer keeps the classic face's chrome — `rounded-2xl`, a
|
||||
* `border/60` hairline, `bg-white/80` over `backdrop-blur-xl`;
|
||||
* - the accent is brand violet, spent where the product already spends it:
|
||||
* focus, active state, the Pro badge;
|
||||
* - the neutral ramp is slate, the same one `ClassroomCard` and the home
|
||||
* chrome use.
|
||||
*
|
||||
* What is NEW is craft, not vocabulary:
|
||||
*
|
||||
* - shadows are layered (contact → mid → wide) instead of one `shadow-xl`
|
||||
* blur, which is most of why v2 read as unstyled;
|
||||
* - the composer gets a real focused state — a violet thread, a widened
|
||||
* violet-tinted cast, and a 1px lift — so the page has one object that
|
||||
* obviously had attention paid to it;
|
||||
* - the canvas is lit rather than blank: a very low-contrast violet-white
|
||||
* pool behind the hero plus a grain wash, both at the edge of visible;
|
||||
* - rail rows hover into one soft neutral pill and nothing else;
|
||||
* - one staggered entrance on load, then nothing animates unprompted.
|
||||
*
|
||||
* Type stays on the product's Inter stack. The hero's problem was never the
|
||||
* typeface, it was that 22px/semibold is body copy in a headline's seat; it is
|
||||
* set properly here (larger, tighter tracking, optical spacing) and left alone.
|
||||
*/
|
||||
|
||||
/* ── Tokens ──────────────────────────────────────────────────────────────
|
||||
Slate ramp + brand violet, matching the rest of the product. */
|
||||
/* The workspace shares the default d-sre-agent appearance with the classic UI. */
|
||||
.ws-root {
|
||||
--ws-canvas-top: #f8fafc; /* slate-50 */
|
||||
--ws-canvas-bottom: #f1f5f9; /* slate-100 */
|
||||
--ws-rail: rgba(255, 255, 255, 0.72);
|
||||
--ws-surface: rgba(255, 255, 255, 0.82);
|
||||
|
||||
/* The ink ramp, re-cut. Every step used to sit within one slate shade of its
|
||||
neighbour, so the rail read as one grey band: the counts (slate-300) came
|
||||
out at 1.5:1 on the rail and the section labels and metadata (slate-400) at
|
||||
2.5:1 — below AA, which is why nothing announced itself. Each step is now a
|
||||
full role with a ratio to defend, measured against the rail's own blended
|
||||
background (#fbfcfd), not against pure white:
|
||||
|
||||
ink 16.5:1 course names, folder names, the active row
|
||||
soft 10.0:1 chat names, section labels — legible, still not black
|
||||
mute 4.7:1 metadata, counts, glyphs, buttons at rest (AA)
|
||||
faint 2.5:1 DECORATION ONLY — separators, rules. Never text.
|
||||
|
||||
The palette is unchanged: these are all slate steps, just further apart. */
|
||||
--ws-ink: #0f172a; /* slate-900 */
|
||||
--ws-ink-soft: #334155; /* slate-700 */
|
||||
--ws-ink-mute: #64748b; /* slate-500 */
|
||||
--ws-ink-faint: #94a3b8; /* slate-400 */
|
||||
|
||||
--ws-line: rgba(15, 23, 42, 0.11);
|
||||
--ws-line-soft: rgba(15, 23, 42, 0.065);
|
||||
--ws-tint: rgba(15, 23, 42, 0.055);
|
||||
--ws-tint-strong: rgba(15, 23, 42, 0.09);
|
||||
|
||||
/* The `@` course menu's row, and how many of them its window shows.
|
||||
The window is a WHOLE NUMBER of rows so the resting state never cuts one in
|
||||
half — which is what the old fixed `max-h` did, and with no scroll on the
|
||||
container that half row was simply unreachable. */
|
||||
--ws-canvas-top: var(--canvas);
|
||||
--ws-canvas-bottom: var(--canvas);
|
||||
--ws-rail: var(--sidebar);
|
||||
--ws-surface: var(--background);
|
||||
--ws-ink: var(--foreground);
|
||||
--ws-ink-soft: var(--foreground);
|
||||
--ws-ink-mute: var(--muted-foreground);
|
||||
--ws-ink-faint: var(--input);
|
||||
--ws-line: var(--border);
|
||||
--ws-line-soft: var(--border);
|
||||
--ws-tint: var(--muted);
|
||||
--ws-tint-strong: var(--accent);
|
||||
--ws-raised: var(--popover);
|
||||
--ws-accent: var(--brand);
|
||||
--ws-accent-thread: var(--input);
|
||||
--ws-accent-wash: var(--brand-muted);
|
||||
--ws-live: #15803d;
|
||||
--ws-fail: var(--destructive);
|
||||
--ws-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
|
||||
--ws-lift: var(--shadow-prompt);
|
||||
--ws-lift-focus: 0 0 0 1px var(--ring);
|
||||
--ws-lift-sm: var(--shadow-menu);
|
||||
--ws-lift-sm-hover: var(--shadow-menu);
|
||||
--ws-grain: none;
|
||||
--ws-cmenu-row-h: 30px;
|
||||
--ws-cmenu-rows: 8;
|
||||
|
||||
/* ── The rail's row template ────────────────────────────────────────────
|
||||
A name in this rail starts at the row's own 8px padding. That is the whole
|
||||
rule, and it is why the tree finally reads as flush with the panel: an empty
|
||||
leading slot reserved on every row (so that a folder's chevron would have a
|
||||
column of its own) pushed all 139 names inward and made the column look
|
||||
indented from nothing. Before that it was worse — five numbers reached a
|
||||
nested name: 8px padding, a 16px slot, an 8px gap, a 14px nest margin, 6px
|
||||
of nest padding and a 1px guide line, 51px in at 21px per level.
|
||||
|
||||
LEAD (+GAP) a glyph slot for the ONLY row kind that has a glyph: a
|
||||
folder. Its name therefore sits one glyph in, and that offset
|
||||
IS the hierarchy. Courses, chats and pager rows carry no
|
||||
leading element, so their names sit at the panel edge.
|
||||
INDENT the ONE nesting step, as a margin and nothing else. Folders
|
||||
do not nest inside folders, so it is applied exactly once.
|
||||
|
||||
They are tokens because this list will grow row kinds (favourites,
|
||||
recents), and a value written twice is the next misalignment. */
|
||||
--ws-tree-indent: 12px;
|
||||
/* One row height for BOTH tabs. A chat row and a course row are the same kind
|
||||
of object — a single line you scan — so switching tabs must not reflow the
|
||||
column. Depth is carried by whitespace alone (no rule, no guide line, no
|
||||
card), and this is the whitespace. */
|
||||
--ws-tree-row-h: 32px;
|
||||
/* A leading GLYPH slot, for the rows that actually have a glyph: a folder.
|
||||
Rows without one (courses, chats, pagers) do not reserve it — an empty slot
|
||||
on every row is what pushed the whole tree right of the panel's own edge.
|
||||
16px box + 8px of air, stated once. */
|
||||
--ws-tree-lead: 16px;
|
||||
--ws-tree-lead-gap: 8px;
|
||||
|
||||
/* THE height of a pane header, for every pane. It is a token rather than a
|
||||
number in each rule because the two headers' bottom hairlines have to be
|
||||
ONE line across the seam: the conversation's header and the classroom's
|
||||
header are different objects (a title and a status word; a tab strip and a
|
||||
button) and the moment either owns its own height they drift apart by a
|
||||
pixel or two and the hairline visibly steps at the seam — which is exactly
|
||||
what happened while the chat header sat at 44px and the classroom's at 42.
|
||||
The value is the classroom's, because that one is DERIVED: 6px of strip
|
||||
inset + a 31px tab + the 5px tail that joins the selected tab to the pane
|
||||
below it. Change it here and both panes move together. */
|
||||
--ws-pane-head-h: 42px;
|
||||
|
||||
/* Floating menus sit OVER the tree, so they are opaque where the rail is
|
||||
translucent: a popover you can read the list through is not a popover. */
|
||||
--ws-raised: #ffffff;
|
||||
|
||||
--ws-accent: #7c3aed; /* violet-600, the product's accent */
|
||||
--ws-accent-thread: rgba(124, 58, 237, 0.32);
|
||||
--ws-accent-wash: rgba(124, 58, 237, 0.08);
|
||||
|
||||
--ws-live: #10b981; /* emerald-500, as v2 */
|
||||
--ws-fail: #f43f5e; /* rose-500, as v2 */
|
||||
|
||||
--ws-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
|
||||
|
||||
/* Layered, not blurred. A contact shadow seats the card, then two wider and
|
||||
softer casts carry it off the page. */
|
||||
--ws-lift:
|
||||
0 1px 1px rgba(15, 23, 42, 0.035), 0 3px 6px -2px rgba(15, 23, 42, 0.04),
|
||||
0 10px 20px -8px rgba(15, 23, 42, 0.05), 0 26px 46px -22px rgba(15, 23, 42, 0.07);
|
||||
/* Focus adds the violet thread the classic composer only hints at
|
||||
(`focus-within:shadow-violet-500/[0.06]`), and commits to it. */
|
||||
--ws-lift-focus:
|
||||
0 0 0 1px var(--ws-accent-thread), 0 0 0 4px var(--ws-accent-wash),
|
||||
0 2px 3px -1px rgba(15, 23, 42, 0.04), 0 8px 16px -4px rgba(15, 23, 42, 0.055),
|
||||
0 22px 40px -14px rgba(15, 23, 42, 0.08), 0 40px 70px -34px rgba(124, 58, 237, 0.14);
|
||||
--ws-lift-sm:
|
||||
0 1px 1px rgba(15, 23, 42, 0.03), 0 2px 4px -1px rgba(15, 23, 42, 0.035),
|
||||
0 6px 12px -6px rgba(15, 23, 42, 0.045);
|
||||
--ws-lift-sm-hover:
|
||||
0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 8px -2px rgba(15, 23, 42, 0.055),
|
||||
0 10px 18px -8px rgba(15, 23, 42, 0.06);
|
||||
|
||||
/* Grain. One inline SVG, tiled — no request, alpha baked in so it works over
|
||||
any background. Tuned to be invisible on a bad panel. */
|
||||
--ws-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='0.04'/%3E%3C/svg%3E");
|
||||
|
||||
background: linear-gradient(180deg, var(--ws-canvas-top) 0%, var(--ws-canvas-bottom) 100%);
|
||||
color: var(--ws-ink);
|
||||
background: var(--canvas);
|
||||
color: var(--foreground);
|
||||
}
|
||||
|
||||
.dark .ws-root {
|
||||
--ws-canvas-top: #020617; /* slate-950 */
|
||||
--ws-canvas-bottom: #0f172a; /* slate-900 */
|
||||
--ws-rail: rgba(15, 23, 42, 0.62);
|
||||
--ws-surface: rgba(15, 23, 42, 0.78);
|
||||
|
||||
/* Dark's ramp was already the better of the two — it cleared AA at every step
|
||||
that carries text — so it is lifted only at the top and the bottom, to keep
|
||||
the ROLES the same distance apart in both themes:
|
||||
|
||||
ink 16.8:1 soft 11.7:1 mute 6.8:1 faint 3.6:1 (decoration)
|
||||
|
||||
Everything dark gains from this pass it gains from usage, not from the
|
||||
ramp: counts and labels moved off `faint`, and the rail's buttons stopped
|
||||
resting at 45% opacity. */
|
||||
--ws-ink: #f8fafc; /* slate-50 */
|
||||
--ws-ink-soft: #cbd5e1; /* slate-300 */
|
||||
--ws-ink-mute: #94a3b8; /* slate-400 */
|
||||
--ws-ink-faint: #64748b; /* slate-500 — decoration only */
|
||||
|
||||
--ws-line: rgba(255, 255, 255, 0.12);
|
||||
--ws-line-soft: rgba(255, 255, 255, 0.07);
|
||||
--ws-tint: rgba(255, 255, 255, 0.06);
|
||||
--ws-tint-strong: rgba(255, 255, 255, 0.1);
|
||||
|
||||
--ws-raised: #1e293b; /* slate-800 — one step above the slate-900 canvas */
|
||||
|
||||
--ws-accent: #a78bfa; /* violet-400 reads on slate-950 */
|
||||
--ws-accent-thread: rgba(167, 139, 250, 0.36);
|
||||
--ws-accent-wash: rgba(167, 139, 250, 0.1);
|
||||
|
||||
--ws-lift:
|
||||
0 1px 1px rgba(0, 0, 0, 0.3), 0 4px 10px -3px rgba(0, 0, 0, 0.32),
|
||||
0 14px 28px -12px rgba(0, 0, 0, 0.38), 0 30px 54px -26px rgba(0, 0, 0, 0.44);
|
||||
--ws-lift-focus:
|
||||
0 0 0 1px var(--ws-accent-thread), 0 0 0 4px var(--ws-accent-wash),
|
||||
0 2px 4px -1px rgba(0, 0, 0, 0.3), 0 10px 20px -5px rgba(0, 0, 0, 0.36),
|
||||
0 26px 48px -16px rgba(0, 0, 0, 0.44), 0 44px 76px -36px rgba(167, 139, 250, 0.2);
|
||||
--ws-lift-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 10px -4px rgba(0, 0, 0, 0.34);
|
||||
--ws-lift-sm-hover: 0 2px 4px rgba(0, 0, 0, 0.34), 0 8px 16px -6px rgba(0, 0, 0, 0.4);
|
||||
|
||||
--ws-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='0.085'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
/* ── Atmosphere ──────────────────────────────────────────────────────────
|
||||
The lamp rides on the scrolling column itself: `background-attachment` is
|
||||
`scroll` by default, which pins a background to the element's own border
|
||||
box, so it stays put while the content scrolls under it. No overlay layer,
|
||||
no z-index ladder, nothing to intercept a click.
|
||||
|
||||
Its box is the FIRST SCREEN — one `100dvh` band, not a fixed 700px — and the
|
||||
pool sits a little above that band's middle, where the lockup and composer
|
||||
now are. The earlier cut lit the top 700px from `50% 1%`, which was right
|
||||
while the hero was pinned to the top and wrong the moment it moved to the
|
||||
centre: a light whose brightest point falls on empty space is a light
|
||||
pointing at nothing. */
|
||||
.ws-canvas {
|
||||
background-image:
|
||||
/* the pool behind hero + composer — violet-white, so the brand tints the
|
||||
light rather than sitting in a swatch somewhere */
|
||||
radial-gradient(58% 34% at 50% 43%, rgba(124, 58, 237, 0.062), rgba(124, 58, 237, 0) 72%),
|
||||
/* a white core inside the pool, so the falloff is not one flat cone and
|
||||
the composer sits in the brightest part of the canvas */
|
||||
radial-gradient(40% 24% at 50% 47%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 74%),
|
||||
var(--ws-grain);
|
||||
background-repeat: no-repeat, no-repeat, repeat;
|
||||
background-size:
|
||||
100% 100dvh,
|
||||
100% 100dvh,
|
||||
160px 160px;
|
||||
background-position:
|
||||
top center,
|
||||
top center,
|
||||
top left;
|
||||
}
|
||||
|
||||
.dark .ws-canvas {
|
||||
background-image:
|
||||
radial-gradient(62% 36% at 50% 43%, rgba(167, 139, 250, 0.075), rgba(167, 139, 250, 0) 70%),
|
||||
radial-gradient(36% 22% at 50% 47%, rgba(226, 232, 240, 0.045), rgba(226, 232, 240, 0) 72%),
|
||||
var(--ws-grain);
|
||||
background: var(--canvas);
|
||||
}
|
||||
|
||||
/* The rail is the product's chrome material — translucent white over the
|
||||
@ -243,8 +44,8 @@
|
||||
.ws-rail {
|
||||
background-color: var(--ws-rail);
|
||||
background-image: var(--ws-grain);
|
||||
backdrop-filter: blur(14px) saturate(140%);
|
||||
-webkit-backdrop-filter: blur(14px) saturate(140%);
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
box-shadow: inset -1px 0 0 0 var(--ws-line-soft);
|
||||
}
|
||||
|
||||
@ -505,10 +306,10 @@
|
||||
through ProLaunchPanel's existing `workspace` variant, so `/` is untouched. */
|
||||
.ws-composer {
|
||||
background-color: var(--ws-surface);
|
||||
backdrop-filter: blur(16px) saturate(150%);
|
||||
-webkit-backdrop-filter: blur(16px) saturate(150%);
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
border: 1px solid var(--ws-line);
|
||||
border-radius: 16px;
|
||||
border-radius: 12px;
|
||||
box-shadow: var(--ws-lift);
|
||||
transition:
|
||||
border-color 220ms var(--ws-ease),
|
||||
@ -698,15 +499,13 @@
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
border-radius: 12px;
|
||||
filter: drop-shadow(0 6px 14px rgba(124, 58, 237, 0.22))
|
||||
drop-shadow(0 1px 2px rgba(15, 23, 42, 0.1));
|
||||
filter: none;
|
||||
user-select: none;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
|
||||
.dark .ws-hero-mark {
|
||||
filter: drop-shadow(0 6px 18px rgba(167, 139, 250, 0.26))
|
||||
drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
|
||||
filter: none;
|
||||
}
|
||||
|
||||
/* ── The tab switch ──────────────────────────────────────────────────────
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
import { type ReactNode, useState } from 'react';
|
||||
import { ArrowLeft } from 'lucide-react';
|
||||
import { useI18n } from '@/lib/hooks/use-i18n';
|
||||
import { useBrand, useIsDesktop } from '@/lib/brand/brand-context';
|
||||
import { BrandLogo } from '@/components/brand-logo';
|
||||
import { arrivedByProSwap } from '@/lib/workbench/pro-swap';
|
||||
import { cn } from '@/lib/utils/cn';
|
||||
import { ProBadge } from '@/components/workbench/ProBadge';
|
||||
@ -62,8 +62,6 @@ export function WorkspaceHome({
|
||||
readonly onExitPro: () => void;
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
const brand = useBrand();
|
||||
const isDesktop = useIsDesktop();
|
||||
|
||||
// Someone who arrived through the Pro swap has just watched the surfaces
|
||||
// crossfade around a fixed lockup and the composer turn over into this face;
|
||||
@ -82,7 +80,7 @@ export function WorkspaceHome({
|
||||
plain button, not a second ProBadge: two elements answering to
|
||||
`pro-mode-exit` would be one testid too many. */}
|
||||
<div className="flex h-12 shrink-0 items-center justify-between px-4 md:hidden">
|
||||
<img src={brand.logoSrc} alt={brand.productName} className="h-5 w-auto" />
|
||||
<BrandLogo markClassName="size-6" />
|
||||
<button
|
||||
type="button"
|
||||
data-testid="pro-workspace-exit-compact"
|
||||
@ -124,26 +122,11 @@ export function WorkspaceHome({
|
||||
data-testid="pro-workspace-hero-lockup"
|
||||
data-pro-morph="lockup"
|
||||
>
|
||||
{isDesktop && !brand.logoHasWordmark ? (
|
||||
// A brand whose mark carries no wordmark gets the product name
|
||||
// beside it, exactly as the classic hero does.
|
||||
<div className="flex items-center gap-3">
|
||||
<img src={brand.markSrc} alt={brand.productName} className="size-11 md:size-14" />
|
||||
<span
|
||||
className="text-xl font-semibold tracking-tight md:text-2xl"
|
||||
style={{ color: brand.themeColor }}
|
||||
>
|
||||
{brand.productName}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<img
|
||||
src={brand.logoSrc}
|
||||
alt={brand.productName}
|
||||
data-testid="pro-workspace-hero-logo"
|
||||
className="ws-hero-logo"
|
||||
/>
|
||||
)}
|
||||
<BrandLogo
|
||||
data-testid="pro-workspace-hero-logo"
|
||||
className="gap-3 text-3xl md:text-4xl"
|
||||
markClassName="size-12 md:size-14"
|
||||
/>
|
||||
{/* At the wordmark's cap height, where a trademark mark goes —
|
||||
offset from the image TOP, not centred on it, and scaled with
|
||||
the 46/56px lockup rather than the classic page's 48/64px. */}
|
||||
|
||||
@ -93,7 +93,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { useI18n } from '@/lib/hooks/use-i18n';
|
||||
import { useBrand } from '@/lib/brand/brand-context';
|
||||
import { BrandLogo } from '@/components/brand-logo';
|
||||
import type { HomeDiscoveryState, useHomeDiscovery } from '@/lib/hooks/use-home-discovery';
|
||||
import { ProBadge } from '@/components/workbench/ProBadge';
|
||||
import { LanguageSwitcher } from '@/components/language-switcher';
|
||||
@ -231,7 +231,6 @@ export function WorkspaceRail({
|
||||
readonly resizeHandle: ReactNode;
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
const brand = useBrand();
|
||||
const foldersAvailable = workspaceFoldersAvailable();
|
||||
|
||||
const coursesSection = useListSearch();
|
||||
@ -845,12 +844,7 @@ export function WorkspaceRail({
|
||||
that leaves Pro. Two different destinations, so two hit targets —
|
||||
never one control wearing both meanings. */}
|
||||
<HomeLink testId="pro-nav-home" onGoHome={onGoHome} className="-ml-1.5 px-1.5 py-1">
|
||||
<img
|
||||
src={brand.logoSrc}
|
||||
alt=""
|
||||
aria-hidden="true"
|
||||
className="h-[21px] w-auto max-w-[110px] shrink-0"
|
||||
/>
|
||||
<BrandLogo className="text-[13px] gap-1.5" markClassName="size-6" />
|
||||
</HomeLink>
|
||||
<ProBadge active onToggle={onExitPro} />
|
||||
{/* THE rail's header, and therefore where the rail folds — the same
|
||||
|
||||
41
docs/downstream/appearance.md
Normal file
41
docs/downstream/appearance.md
Normal file
@ -0,0 +1,41 @@
|
||||
# D-Robotics appearance
|
||||
|
||||
Reference: `d-cloud/d-sre-agent`, revision `f9dcf24e967be6384dbc4eb3e430fbcfdf14c717`.
|
||||
Sources: `apps/web/src/theme.css`, `components/ui/control-appearance.css`, and
|
||||
`features/control-plane/global-navigation.css`. This ports the default appearance,
|
||||
not the reference application's navigation or operations features.
|
||||
|
||||
| Role | Light | Dark |
|
||||
| --- | --- | --- |
|
||||
| Canvas | `#f5f5f5` | `#0a0a0a` |
|
||||
| Background | `#ffffff` | `#0a0a0a` |
|
||||
| Sidebar | `#fafafa` | `#171717` |
|
||||
| Ink / primary action | `#171717` | `#f5f5f5` |
|
||||
| Muted text | `#525252` | `#a3a3a3` |
|
||||
| Border | `#e5e5e5` | `#262626` |
|
||||
| Brand accent | `#ea580c` | `#fb923c` |
|
||||
|
||||
System font, 4/6/8/10/12px corner radii, thin borders, restrained menu and input
|
||||
shadows. Primary actions use neutral ink; brand orange marks small highlights.
|
||||
The deployed product is named 地瓜学习平台. `components/brand-logo.tsx` combines
|
||||
the product name with the unmodified D-Robotics icon. The icon is bundled locally
|
||||
from https://cloud.d-robotics.cc/d-cloud/assets/logo_light-1UghWW5d.png.
|
||||
A white tile keeps the supplied light-theme icon legible in dark mode.
|
||||
Product identity is configured in `lib/brand/brand-config.ts`; storage and protocol
|
||||
identifiers retain their upstream names to preserve existing course data.
|
||||
|
||||
`app/globals.css` owns semantic theme tokens. The Pro workspace maps its existing
|
||||
`--ws-*` variables onto those tokens. Home, playback chrome, chat, quiz controls,
|
||||
settings and shared fields use neutral surfaces instead of purple/slate glass.
|
||||
Authored slide colors, avatars, media and semantic success/error colors are retained.
|
||||
|
||||
When updating upstream, keep this as an independent downstream style change. Avoid
|
||||
replacing global Tailwind color ramps: imported course content may use those colors.
|
||||
|
||||
## Classroom interaction layout (2026-09-23)
|
||||
|
||||
The classroom uses a left outline, central lesson canvas, and a right interaction panel (380–480 px). Notes and conversation history share tabs; the current narration, discussion actions, voice input, and a persistent text composer live below them. The playback toolbar stays immediately below the canvas, rendered from the same Roundtable instance through a portal so playback state and controls remain shared. Collapsing the interaction panel keeps its draft and toolbar mounted. Below 900 px the panel becomes a right drawer, initially closed, with an explicit reopen button.
|
||||
|
||||
References: [Udemy course player](https://support.udemy.com/hc/en-us/articles/229603648-How-to-Use-The-Course-Player-and-Start-Your-Course), [Khanmigo help](https://support.khanacademy.org/hc/en-us/articles/14799047733645-What-teacher-tools-are-available-on-Khanmigo). These informed separating lesson content from learning assistance; this is a project-specific layout, not a reproduction of either product.
|
||||
|
||||
Validated desktop layout, mobile 390 px bounds, collapse/reopen draft retention and toolbar availability, TypeScript, and the existing 8 element-reference/interruption regression tests.
|
||||
24
docs/downstream/course-market.md
Normal file
24
docs/downstream/course-market.md
Normal file
@ -0,0 +1,24 @@
|
||||
# 课程市场
|
||||
|
||||
入口:首页右上角“课程市场”,路径 `/courses`。
|
||||
|
||||
## 内容与发布
|
||||
|
||||
- `lib/course-market/chapters.json`:52 章、260 小节、1560 知识点,来自已整理的 RDK 零基础知识大纲。保留章节编号、先修、领域和层级。
|
||||
- `lib/course-market/catalog.ts`:平台精选课程清单。每门课程有独立 ID、章节 ID、版本、介绍、课时与课程包地址。同一章允许多门课程。
|
||||
- `public/courses/`:可公开下载的 `.maic.zip` 教学包。目前发布第 18 章 RDK 板卡识别课,40 页。
|
||||
- 无已发布课程的章节标为“待上线”,可以查看知识大纲。
|
||||
|
||||
新增课程:导出并检查 `.maic.zip`,放入 `public/courses/`,在清单添加记录,执行测试后正常构建发布。修改课程内容时增加版本号并使用新文件名。课程包仅包含拟公开的课件和素材,不包含个人笔记或密钥。
|
||||
|
||||
## 学习与存储
|
||||
|
||||
首次点击“进入学习”通过现有课程导入器写入学习者自己的课程存储,之后进入课堂。浏览器按课程 ID 和版本记住课堂 ID,重复进入会恢复该课堂;若课堂已删除则重新导入。个人学习状态不写回公共课程包。
|
||||
|
||||
本版提供统一发布和浏览,不包含用户投稿、付费或后台管理。浏览器课程数据仍遵循平台现有存储机制,不保证跨设备同步。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm exec vitest run tests/lib/brand/course-market.test.ts`
|
||||
- `pnpm exec tsc --noEmit`
|
||||
- 浏览器验证:搜索知识点、领域和上线状态筛选、展开小节、无结果状态、首次导入与重复进入、390px 手机布局。
|
||||
@ -25,10 +25,10 @@ export interface BrandConfig {
|
||||
|
||||
/** The default brand: the product itself, with no vendor overrides. */
|
||||
export const DEFAULT_BRAND: BrandConfig = {
|
||||
productName: 'OpenMAIC',
|
||||
shortName: 'OpenMAIC',
|
||||
logoSrc: '/logo-horizontal.png',
|
||||
logoHasWordmark: true,
|
||||
markSrc: '/openmaic-mark.png',
|
||||
themeColor: '#722ed1',
|
||||
productName: '地瓜学习平台',
|
||||
shortName: '地瓜学习平台',
|
||||
logoSrc: '/d-robotics-logo.png',
|
||||
logoHasWordmark: false,
|
||||
markSrc: '/d-robotics-logo.png',
|
||||
themeColor: '#ea580c',
|
||||
};
|
||||
|
||||
53
lib/course-market/catalog.ts
Normal file
53
lib/course-market/catalog.ts
Normal file
@ -0,0 +1,53 @@
|
||||
import chapters from './chapters.json';
|
||||
|
||||
export { chapters };
|
||||
export type Chapter = (typeof chapters)[number];
|
||||
|
||||
export interface MarketCourse {
|
||||
id: string;
|
||||
chapterId: string;
|
||||
title: string;
|
||||
description: string;
|
||||
duration: string;
|
||||
pages: number;
|
||||
packageUrl: string;
|
||||
version: number;
|
||||
}
|
||||
|
||||
/** Platform-curated, versioned packages. Never link to another browser's local classroom ID. */
|
||||
export const courses: MarketCourse[] = [
|
||||
{
|
||||
id: 'rdk-identity',
|
||||
chapterId: '18',
|
||||
title: '认识你的 RDK:板卡、型号与版本识别',
|
||||
description:
|
||||
'以 X5 为主例、S100 为对照,从看懂板卡到填写设备身份记录卡。没有板卡也能跟随教学证据练习。',
|
||||
duration: '3 课时 · 120 分钟',
|
||||
pages: 40,
|
||||
packageUrl: '/courses/rdk-identity-v1.maic.zip',
|
||||
version: 1,
|
||||
},
|
||||
];
|
||||
|
||||
export function searchChapters(query: string, domain: string, publishedOnly: boolean) {
|
||||
const needle = query.trim().toLocaleLowerCase();
|
||||
return chapters.filter((chapter) => {
|
||||
if (domain && chapter.domain !== domain) return false;
|
||||
const matchingCourses = courses.filter((course) => course.chapterId === chapter.id);
|
||||
if (publishedOnly && matchingCourses.length === 0) return false;
|
||||
const searchable = [
|
||||
chapter.id,
|
||||
chapter.title,
|
||||
chapter.domain,
|
||||
chapter.level,
|
||||
...chapter.sections.flatMap((section) => [
|
||||
section.title,
|
||||
...section.points.map((point) => point.title),
|
||||
]),
|
||||
...matchingCourses.map((course) => `${course.title} ${course.description}`),
|
||||
]
|
||||
.join(' ')
|
||||
.toLocaleLowerCase();
|
||||
return !needle || searchable.includes(needle);
|
||||
});
|
||||
}
|
||||
11390
lib/course-market/chapters.json
Normal file
11390
lib/course-market/chapters.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@
|
||||
"close": "Close"
|
||||
},
|
||||
"home": {
|
||||
"slogan": "Generative Learning in Multi-Agent Interactive Classroom",
|
||||
"slogan": "Learn RDK and robotics from the ground up",
|
||||
"greetingWithName": "Hi, {{name}}"
|
||||
},
|
||||
"toolbar": {
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
"close": "关闭"
|
||||
},
|
||||
"home": {
|
||||
"slogan": "Generative Learning in Multi-Agent Interactive Classroom",
|
||||
"slogan": "从零开始,探索 RDK 与机器人",
|
||||
"greetingWithName": "嗨,{{name}}"
|
||||
},
|
||||
"toolbar": {
|
||||
|
||||
@ -342,14 +342,8 @@ export function useImportClassroom(onSuccess?: (importedStageId: string) => void
|
||||
fileInputRef.current?.click();
|
||||
}, []);
|
||||
|
||||
const handleFileChange = useCallback(
|
||||
async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
|
||||
// Reset input so same file can be re-selected
|
||||
e.target.value = '';
|
||||
|
||||
const importFile = useCallback(
|
||||
async (file: File) => {
|
||||
setImporting(true);
|
||||
setPhase('parsing');
|
||||
const toastId = toast.loading(t('import.parsing'));
|
||||
@ -565,7 +559,17 @@ export function useImportClassroom(onSuccess?: (importedStageId: string) => void
|
||||
[t, onSuccess],
|
||||
);
|
||||
|
||||
const handleFileChange = useCallback(
|
||||
async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
e.target.value = '';
|
||||
if (file) await importFile(file);
|
||||
},
|
||||
[importFile],
|
||||
);
|
||||
|
||||
return {
|
||||
importFile,
|
||||
importing,
|
||||
phase,
|
||||
fileInputRef,
|
||||
|
||||
@ -218,7 +218,9 @@ async function directorNode(
|
||||
};
|
||||
} catch (error) {
|
||||
log.error('[Director] Error:', error);
|
||||
return { shouldEnd: true };
|
||||
// Propagate provider failures to the SSE error channel. Ending the graph
|
||||
// here silently converts denied keys and failed requests into empty replies.
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -401,8 +401,8 @@ export class PlaybackEngine {
|
||||
this.actionEngine.clearEffects();
|
||||
this.currentTopicState = 'closed';
|
||||
|
||||
// Close whiteboard if it was open during the discussion
|
||||
useCanvasStore.getState().setWhiteboardOpen(false);
|
||||
// Keep the generated board visible for review after Q&A. Explicit close
|
||||
// actions, the learner toggle, and scene navigation still control visibility.
|
||||
|
||||
// Restore the interrupted lecture cursor before notifying consumers. The
|
||||
// callback may inspect isExhausted() to decide whether playback completed.
|
||||
|
||||
BIN
public/courses/rdk-identity-v1.maic.zip
Normal file
BIN
public/courses/rdk-identity-v1.maic.zip
Normal file
Binary file not shown.
BIN
public/d-robotics-logo.png
Normal file
BIN
public/d-robotics-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
@ -217,7 +217,10 @@ vi.mock('@/components/roundtable', async () => {
|
||||
vi.mock('@/components/chat/chat-area', async () => {
|
||||
const React = await import('react');
|
||||
return {
|
||||
ChatArea: React.forwardRef(function MockChatArea(_props, ref) {
|
||||
ChatArea: React.forwardRef(function MockChatArea(
|
||||
props: { interaction?: React.ReactNode },
|
||||
ref,
|
||||
) {
|
||||
React.useImperativeHandle(ref, () => ({
|
||||
sendMessage: mocks.sendMessage,
|
||||
endActiveSession: vi.fn().mockResolvedValue(undefined),
|
||||
@ -236,7 +239,7 @@ vi.mock('@/components/chat/chat-area', async () => {
|
||||
resumeBuffer: vi.fn(),
|
||||
resumeActiveSession: vi.fn(),
|
||||
}));
|
||||
return null;
|
||||
return props.interaction ?? null;
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
@ -2,15 +2,15 @@ import { describe, expect, it } from 'vitest';
|
||||
import { DEFAULT_BRAND } from '@/lib/brand/brand-config';
|
||||
|
||||
describe('DEFAULT_BRAND (single-brand build)', () => {
|
||||
it('uses the original product identity for full chrome', () => {
|
||||
expect(DEFAULT_BRAND.productName).toBe('OpenMAIC');
|
||||
expect(DEFAULT_BRAND.shortName).toBe('OpenMAIC');
|
||||
expect(DEFAULT_BRAND.markSrc).toBe('/openmaic-mark.png');
|
||||
expect(DEFAULT_BRAND.themeColor).toBe('#722ed1');
|
||||
it('uses the requested D-Robotics learning identity', () => {
|
||||
expect(DEFAULT_BRAND.productName).toBe('地瓜学习平台');
|
||||
expect(DEFAULT_BRAND.shortName).toBe('地瓜学习平台');
|
||||
expect(DEFAULT_BRAND.markSrc).toBe('/d-robotics-logo.png');
|
||||
expect(DEFAULT_BRAND.themeColor).toBe('#ea580c');
|
||||
});
|
||||
|
||||
it('marks its horizontal logo as already containing the wordmark', () => {
|
||||
expect(DEFAULT_BRAND.logoHasWordmark).toBe(true);
|
||||
expect(DEFAULT_BRAND.logoSrc).toBe('/logo-horizontal.png');
|
||||
it('keeps the supplied icon separate from the product name', () => {
|
||||
expect(DEFAULT_BRAND.logoHasWordmark).toBe(false);
|
||||
expect(DEFAULT_BRAND.logoSrc).toBe('/d-robotics-logo.png');
|
||||
});
|
||||
});
|
||||
|
||||
41
tests/lib/brand/course-market.test.ts
Normal file
41
tests/lib/brand/course-market.test.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import JSZip from 'jszip';
|
||||
import { chapters, courses, searchChapters } from '@/lib/course-market/catalog';
|
||||
|
||||
describe('course market catalog', () => {
|
||||
it('includes the complete curriculum with valid prerequisite references', () => {
|
||||
expect(chapters).toHaveLength(52);
|
||||
expect(new Set(chapters.map((chapter) => chapter.id)).size).toBe(52);
|
||||
expect(chapters.flatMap((chapter) => chapter.sections)).toHaveLength(260);
|
||||
expect(
|
||||
chapters.flatMap((chapter) => chapter.sections.flatMap((section) => section.points)),
|
||||
).toHaveLength(1560);
|
||||
for (const chapter of chapters) {
|
||||
for (const prerequisite of chapter.prerequisites)
|
||||
expect(chapters.some((item) => item.id === prerequisite)).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('filters published courses, searches nested knowledge points, and combines filters', () => {
|
||||
expect(searchChapters('', '', true).map((chapter) => chapter.id)).toEqual(['18']);
|
||||
expect(searchChapters('CPU 是什么', '', false).some((chapter) => chapter.id === '02')).toBe(
|
||||
true,
|
||||
);
|
||||
expect(searchChapters(' rdk ', '', true).map((chapter) => chapter.id)).toEqual(['18']);
|
||||
expect(searchChapters('', '不存在的领域', true)).toEqual([]);
|
||||
expect(searchChapters('不存在的课程名称', '', false)).toEqual([]);
|
||||
});
|
||||
|
||||
it('publishes real, self-contained classroom packages matching their catalog entries', async () => {
|
||||
for (const course of courses) {
|
||||
expect(chapters.some((chapter) => chapter.id === course.chapterId)).toBe(true);
|
||||
const zip = await JSZip.loadAsync(readFileSync(`public${course.packageUrl}`));
|
||||
const manifest = JSON.parse(await zip.file('manifest.json')!.async('text'));
|
||||
expect(manifest.stage.name).toBe(course.title);
|
||||
expect(manifest.scenes).toHaveLength(course.pages);
|
||||
for (const mediaPath of Object.keys(manifest.mediaIndex))
|
||||
expect(zip.file(mediaPath)).not.toBeNull();
|
||||
}
|
||||
});
|
||||
});
|
||||
63
tests/orchestration/director-error.test.ts
Normal file
63
tests/orchestration/director-error.test.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import type { LanguageModel } from 'ai';
|
||||
import type { StatelessChatRequest, StatelessEvent } from '@/lib/types/chat';
|
||||
|
||||
const { generate } = vi.hoisted(() => ({ generate: vi.fn() }));
|
||||
vi.mock('@/lib/orchestration/ai-sdk-adapter', () => ({
|
||||
AISdkLangGraphAdapter: class {
|
||||
_generate = generate;
|
||||
},
|
||||
}));
|
||||
vi.mock('@/lib/orchestration/director-prompt', () => ({
|
||||
buildDirectorPrompt: () => 'Choose a speaker.',
|
||||
parseDirectorDecision: () => ({ shouldEnd: true }),
|
||||
}));
|
||||
vi.mock('@/lib/orchestration/registry/store', () => ({
|
||||
useAgentRegistry: {
|
||||
getState: () => ({ getAgent: (id: string) => ({ id, name: id, role: 'teacher' }) }),
|
||||
},
|
||||
}));
|
||||
|
||||
import { statelessGenerate } from '@/lib/orchestration/stateless-generate';
|
||||
|
||||
const request: StatelessChatRequest = {
|
||||
messages: [{ id: 'question', role: 'user', parts: [{ type: 'text', text: 'What is RDK?' }] }],
|
||||
storeState: {
|
||||
stage: null,
|
||||
scenes: [],
|
||||
currentSceneId: null,
|
||||
mode: 'playback',
|
||||
whiteboardOpen: false,
|
||||
},
|
||||
config: { agentIds: ['teacher', 'student'], sessionType: 'qa' },
|
||||
apiKey: 'test-only',
|
||||
};
|
||||
|
||||
async function events() {
|
||||
const result: StatelessEvent[] = [];
|
||||
for await (const event of statelessGenerate(
|
||||
request,
|
||||
new AbortController().signal,
|
||||
{} as LanguageModel,
|
||||
))
|
||||
result.push(event);
|
||||
return result;
|
||||
}
|
||||
|
||||
describe('director failure reporting', () => {
|
||||
it('emits an SSE error instead of silently ending when the provider rejects a model', async () => {
|
||||
generate.mockRejectedValueOnce(new Error('key not allowed to access model'));
|
||||
const result = await events();
|
||||
expect(result).toContainEqual({
|
||||
type: 'error',
|
||||
data: { message: 'key not allowed to access model' },
|
||||
});
|
||||
expect(result.some((event) => event.type === 'done')).toBe(false);
|
||||
});
|
||||
it('still completes normally when the director deliberately ends a conversation', async () => {
|
||||
generate.mockResolvedValueOnce({ generations: [{ text: 'END' }] });
|
||||
const result = await events();
|
||||
expect(result.some((event) => event.type === 'done')).toBe(true);
|
||||
expect(result.some((event) => event.type === 'error')).toBe(false);
|
||||
});
|
||||
});
|
||||
@ -16,6 +16,7 @@ import {
|
||||
readActionResumeState,
|
||||
saveActionResumePosition,
|
||||
} from '@/lib/playback/action-resume';
|
||||
import { useCanvasStore } from '@/lib/store/canvas';
|
||||
import { useSettingsStore } from '@/lib/store/settings';
|
||||
import type { Action } from '@/lib/types/action';
|
||||
import type { Scene } from '@/lib/types/stage';
|
||||
@ -568,7 +569,10 @@ describe('PlaybackEngine action navigation', () => {
|
||||
|
||||
engine.handleUserInterrupt('One more question');
|
||||
expect(engine.hasLectureInterruption()).toBe(true);
|
||||
useCanvasStore.getState().setWhiteboardOpen(true);
|
||||
engine.handleEndDiscussion();
|
||||
expect(useCanvasStore.getState().whiteboardOpen).toBe(true);
|
||||
useCanvasStore.getState().setWhiteboardOpen(false);
|
||||
|
||||
expect(exhaustedAtDiscussionEnd).toEqual([false]);
|
||||
expect(engine.getSnapshot().actionIndex).toBe(0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user