Files
openmaic/OpenMAIC/components/scene-renderers/pbl/v2/instructor-intro.ts
2026-08-16 14:58:47 +08:00

18 lines
682 B
TypeScript

/**
* PBL v2 — learner-facing instructor intro (avatar hover tooltip text).
*
* Pure (no React) so the "what text to show / when there's none" rule is
* unit-testable. The instructor's `description` is curated by the planner to be
* learner-readable; the avatar shows it on hover. Returns undefined when it's
* absent/blank so the caller can fall back to the role name.
*/
import type { PBLRole } from '@/lib/pbl/v2/types';
import { trimmedPBLText } from '@/lib/pbl/v2/readers';
export function instructorIntroText(
role?: Pick<PBLRole, 'description'> | null,
): string | undefined {
const text = trimmedPBLText(role?.description);
return text ? text : undefined;
}