Files
makelore/tests/e2e/fixtures/teacher-reply-layout.tsx
2026-09-30 00:04:40 +08:00

37 lines
2.3 KiB
TypeScript

import { useState } from 'react';
import { createRoot } from 'react-dom/client';
import { fixtureAgent } from './teacher-reply-api';
import { CodingComposer } from '../../../src/pages/Chat/CodingComposer';
import { TeacherChatPanel } from '../../../src/pages/Chat/TeacherChatPanel';
import '../../../src/styles/globals.css';
import '../../../src/pages/Chat/classroom-workspace.css';
import 'katex/dist/katex.min.css';
const params = new URLSearchParams(location.search);
const chat = params.get('chat');
const continuous = chat !== 'legacy';
const width = Number(params.get('width')) || 508;
const compareComposers = params.get('compareComposers') === '1';
export function OperationComposerComparison() {
const [draft, setDraft] = useState('');
return <main className="classroom-main flex min-h-0 min-w-0 flex-1 flex-col">
<div className="min-h-0 flex-1 p-8"><h1 className="text-lg">我的小狗世界</h1><p className="mt-4 text-sm text-muted-foreground">操作 Agent</p></div>
<div className="classroom-composer-view shrink-0">
<CodingComposer value={draft} onChange={setDraft} editable canSend={Boolean(draft.trim())}
preparing={false} recovering={false} runStatus="idle" mode="prompt" queue={{ items: [] }}
error={null} recoverableError={false} attachments={[]} submitting={false}
placeholder="告诉操作 Agent 你的想法" voiceScopeKey="composer-layout-fixture"
onModeChange={() => {}} onSubmit={() => setDraft('')} onRecover={() => {}}
onAddFiles={() => {}} onRemoveAttachment={() => {}} />
</div>
</main>;
}
createRoot(document.getElementById('root')!).render(<div className="classroom-workspace flex h-screen flex-col bg-white">
<header className="flex h-10 shrink-0 items-center border-b px-5 text-xs">智能体回复交互测试 · 真实页面组件 / 模拟回复</header>
<div className="flex min-h-0 flex-1 justify-end bg-[#f5f5f1]">
{compareComposers ? <OperationComposerComparison /> : <main className="min-w-0 flex-1 p-8"><h1 className="text-lg">我的小狗世界</h1><p className="mt-4 text-sm text-muted-foreground">作品区域</p></main>}
<div className="h-full shrink-0 border-l" style={{ width }}><TeacherChatPanel projectId="fixture" sourceId={chat === 'continuous' ? 'original-source' : 'source'} selectedAgent={continuous ? fixtureAgent : undefined} /></div>
</div>
</div>);