/* Topic page — explanation, scenario, then the test component */ function TopicScreen({ topicId, onNavTopic, onNavHome, user, onLogout }) { const topic = window.TOPICS_BY_ID[topicId]; const allIds = window.TOPICS.map((t) => t.id); const idx = allIds.indexOf(topicId); const prev = idx > 0 ? window.TOPICS[idx - 1] : null; const next = idx < window.TOPICS.length - 1 ? window.TOPICS[idx + 1] : null; const [resetKey, setResetKey] = useState(0); const TestComponent = window.TestComponents[topicId]; if (!topic) { return (
{topic.description}