fix: keep first work preview full height during teacher welcomes
This commit is contained in:
1 parent
fe1a3775c5
commit
d12d214d7f
8 files changed
+187
-34
No files matched your search
@@ -794,7 +794,7 @@ export function CodingChatPanel({
|
||||
onToggleConsultation={() => setConsultationOpen((current) => !current)}
|
||||
projectName={activeProject?.name}
|
||||
consultationOpen={consultationOpen}
|
||||
teacherEntry={activeProject ? <TeacherCompanion companion={teacherCompanion} open={consultationOpen} onOpen={openTeacher} onToggle={toggleTeacher} bubbleRef={setTeacherBubble} introductionRef={setTeacherIntroduction} /> : undefined}
|
||||
teacherEntry={activeProject ? <TeacherCompanion companion={teacherCompanion} open={consultationOpen} onOpen={openTeacher} onToggle={toggleTeacher} bubbleRef={setTeacherBubble} introductionRef={setTeacherIntroduction} showWelcomes={!agentBrowserOpen} /> : undefined}
|
||||
/>
|
||||
|
||||
<div className="classroom-workspace-toolbar" data-testid="classroom-workspace-toolbar">
|
||||
|
||||
@@ -6,13 +6,15 @@ import { TeacherIntroduction } from './TeacherIntroduction';
|
||||
import type { useTeacherCompanion } from './use-teacher-companion';
|
||||
|
||||
type Companion = ReturnType<typeof useTeacherCompanion>;
|
||||
export function TeacherCompanion({ companion, open, onOpen, onToggle, bubbleRef, introductionRef }: {
|
||||
export function TeacherCompanion({ companion, open, onOpen, onToggle, bubbleRef, introductionRef, showWelcomes = true }: {
|
||||
companion: Companion;
|
||||
open: boolean;
|
||||
onOpen(agentId?: string): void;
|
||||
onToggle?(agentId?: string): void;
|
||||
bubbleRef?: Ref<HTMLDivElement>;
|
||||
introductionRef?: Ref<HTMLDivElement>;
|
||||
/** Temporarily hide introductions without consuming their persisted state. */
|
||||
showWelcomes?: boolean;
|
||||
}) {
|
||||
const { definition, invitation, welcome, welcomes, loading, enabled, checking, error } = companion;
|
||||
const [introductionId, setIntroductionId] = useState<string | null>(null);
|
||||
@@ -60,7 +62,7 @@ export function TeacherCompanion({ companion, open, onOpen, onToggle, bubbleRef,
|
||||
<RefreshCw className={`h-3.5 w-3.5 shrink-0 ${companion.refreshing ? 'animate-spin motion-reduce:animate-none' : ''}`} aria-hidden="true" />
|
||||
</button>
|
||||
<span className="sr-only" role="status" aria-live="polite">{refreshMessage}</span>
|
||||
{!invitation && welcomes.length > 0 && <div ref={bubbleRef} className="teacher-welcome-presence" data-testid="teacher-welcomes" aria-label="认识这里的老师">
|
||||
{showWelcomes && !invitation && welcomes.length > 0 && <div ref={bubbleRef} className="teacher-welcome-presence" data-testid="teacher-welcomes" aria-label="认识这里的老师">
|
||||
<div className="teacher-welcome-list">
|
||||
{welcomes.map((item, index) => <article key={item.agentId} className="teacher-welcome-card" data-agent-id={item.agentId}
|
||||
data-tone={item.tone} style={{ '--welcome-delay': `${Math.min(index, 4) * 180}ms` } as CSSProperties}>
|
||||
@@ -80,7 +82,7 @@ export function TeacherCompanion({ companion, open, onOpen, onToggle, bubbleRef,
|
||||
</article>)}
|
||||
</div>
|
||||
</div>}
|
||||
{(invitation || welcome) && <div ref={bubbleRef} className="teacher-companion-presence" data-testid="teacher-presence">
|
||||
{(invitation || (showWelcomes && welcome)) && <div ref={bubbleRef} className="teacher-companion-presence" data-testid="teacher-presence">
|
||||
<div className="teacher-companion-bubble" data-testid="teacher-invitation" data-bubble-kind={invitation ? 'check-in' : 'welcome'}>
|
||||
<div className="teacher-companion-bubble-heading">
|
||||
<div className="teacher-companion-invitation-label">{name}</div>
|
||||
|
||||
Reference in new issue
Block a user