/* 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 (
Unknown topic.
); } return (
{String(idx + 1).padStart(2, "0")} / {String(window.TOPICS.length).padStart(2, "0")} {topic.tags.map((t) => ( {t} ))}

{topic.title}

{topic.description}

Explanation
${topic.explanation}

` }} />
Scenario
    {topic.scenario.map((s, i) => (
  1. ))}
Test component
setResetKey((k) => k + 1)} > {TestComponent ? :
Component not implemented.
}
); } window.TopicScreen = TopicScreen;