@@ -8,20 +8,22 @@ import AIPanel from '@/components/AIPanel';
88import ChatPanel from '@/components/ChatPanel' ;
99import WritingArea from '@/components/WritingArea' ;
1010import { log } from '@/lib/logging' ;
11- import { letterToCondition } from '@/lib/studyConfig' ;
11+ import { letterToCondition , getScenario } from '@/lib/studyConfig' ;
1212
1313export default function TaskPage ( ) {
1414 const searchParams = useSearchParams ( ) ;
1515 const writingAreaRef = useRef < WritingAreaRef > ( null ) ;
1616 const username = searchParams . get ( 'username' ) || '' ;
1717 const conditionCode = ( searchParams . get ( 'condition' ) || 'n' ) as keyof typeof letterToCondition ; // TODO: don't default!
1818 const condition = letterToCondition [ conditionCode ] ;
19+ const scenarioId = searchParams . get ( 'scenario' ) || undefined ;
20+ const scenario = getScenario ( scenarioId ) ;
1921
2022 // Collapsible chat state
2123 const [ isChatOpen , setIsChatOpen ] = useState ( false ) ;
2224 const [ hasUnread , setHasUnread ] = useState ( false ) ;
2325
24- // Auto-expand chat after a short delay so participants see Sarah 's messages
26+ // Auto-expand chat after a short delay so participants see the colleague 's messages
2527 useEffect ( ( ) => {
2628 const delayTime = 1000 ; // 1 second
2729 const timer = setTimeout ( ( ) => {
@@ -88,7 +90,7 @@ export default function TaskPage() {
8890 { isChatOpen ? (
8991 < >
9092 < div className = "flex items-center gap-2 font-semibold text-gray-700 text-sm" >
91- < span > Chat with Sarah </ span >
93+ < span > Chat with { scenario . colleague . firstName } </ span >
9294 </ div >
9395 < button
9496 type = "button"
@@ -109,10 +111,10 @@ export default function TaskPage() {
109111 setIsChatOpen ( true ) ;
110112 } }
111113 className = "flex-1 flex items-center justify-between hover:bg-gray-50 -mx-4 px-4 h-full cursor-pointer rounded-t-lg"
112- aria-label = " Open chat with Sarah"
114+ aria-label = { ` Open chat with ${ scenario . colleague . firstName } ` }
113115 >
114116 < div className = "flex items-center gap-2 font-semibold text-gray-700 text-sm" >
115- < span > Chat with Sarah </ span >
117+ < span > Chat with { scenario . colleague . firstName } </ span >
116118 { hasUnread && (
117119 < span className = "flex h-5 w-5 items-center justify-center rounded-full bg-red-500 text-[10px] font-bold text-white shadow-sm" >
118120 1
0 commit comments