"use client"; import { FillBlank } from "./FillBlank"; import { Flashcard } from "./Flashcard"; import { Matching } from "./Matching"; import { MultipleChoice } from "./MultipleChoice"; import { Ordering } from "./Ordering"; import { ShortAnswer } from "./ShortAnswer"; import { TrueFalse } from "./TrueFalse"; import { t } from "@/lib/i18n"; import { type ActivityComponentProps } from "./shared"; export type { ActivityComponentProps } from "./shared"; export { TYPE_META } from "./shared"; /** * Renders an activity from JSON based on its `type` field. * Every activity type is a self-contained React component. */ export function ActivityRenderer(props: ActivityComponentProps) { const { activity } = props; switch (activity.type) { case "flashcard": return ; case "multiple_choice": return ; case "true_false": return ; case "fill_blank": return ; case "matching": return ; case "ordering": return ; case "short_answer": return ; default: { // Exhaustiveness guard: adding a new activity type without a component // becomes a TypeScript error. const never: never = activity; return

{t("activity.unsupported", { json: JSON.stringify(never) })}

; } } }