split intro text consistently into bubbles #100

pull/120/head
Jon Eugster 1 year ago committed by joneugster
parent 3a3471c615
commit 24eed37f89

@ -136,13 +136,14 @@ function ChatPanel({lastLevel}) {
// // chatRef.current!.scrollTo(0,0) // // chatRef.current!.scrollTo(0,0)
// }, [gameId, worldId, levelId]) // }, [gameId, worldId, levelId])
let introText: Array<string> = level?.data?.introduction.split(/\n(\s*\n)+/)
return <div className="chat-panel"> return <div className="chat-panel">
<div ref={chatRef} className="chat"> <div ref={chatRef} className="chat">
{level?.data?.introduction && {introText?.filter(t => t.trim()).map(((t, i) =>
<div className={`message information step-0${selectedStep === 0 ? ' selected' : ''}`} onClick={toggleSelection(0)}> <Hint key={`intro-p-${i}`}
<Markdown>{level?.data?.introduction}</Markdown> hint={{text: t, hidden: false}} step={0} selected={null} toggleSelection={undefined} />
</div> ))}
}
{proof.map((step, i) => { {proof.map((step, i) => {
// It the last step has errors, it will have the same hints // It the last step has errors, it will have the same hints
// as the second-to-last step. Therefore we should not display them. // as the second-to-last step. Therefore we should not display them.
@ -421,10 +422,6 @@ function Introduction({impressum, setImpressum}) {
const gameInfo = useGetGameInfoQuery({game: gameId}) const gameInfo = useGetGameInfoQuery({game: gameId})
const closeImpressum = () => {
setImpressum(false)
}
const toggleImpressum = () => { const toggleImpressum = () => {
setImpressum(!impressum) setImpressum(!impressum)
} }

Loading…
Cancel
Save