'use client'; import type { Dispatch } from 'react'; import type { AppState, AppAction, AppMode } from '@/types'; import TaskCard from './TaskCard'; import MessageList from './MessageList'; import ChatInput from './ChatInput'; interface Props { state: AppState; dispatch: Dispatch; onSendMessage: (text: string) => void; onSendClassroomMessage: (text: string) => void; onSubmit: () => void; onSetAppMode: (mode: AppMode) => void; } export default function ChatPane({ state, onSendMessage, onSendClassroomMessage, onSetAppMode }: Props) { const isClassroom = state.appMode === 'classroom'; const isTaskLoading = state.phase === 'loading_task'; // In classroom mode "busy" only covers classroom chat replies, not lesson generation const isBusy = isClassroom ? state.isStreaming && state.lessonContent !== null : state.isStreaming || state.phase === 'executing'; const messages = isClassroom ? state.classroomMessages : state.messages; const handleSend = isClassroom ? onSendClassroomMessage : onSendMessage; const showChatStreaming = isClassroom ? state.isStreaming && state.lessonContent !== null : state.isStreaming && state.phase !== 'loading_task'; const chatStreamingContent = showChatStreaming ? state.streamingContent : ''; return (
{/* Header */}
Professor {isBusy && (
Thinking…
)} {/* Mode toggle */}
{/* Task card — homework only */} {!isClassroom && ( )} {/* Error banner */} {state.error && (
{state.error}
)} {/* Messages */} {/* Input */}
); }