"use client"; import { motion } from "framer-motion"; import { useState } from "react"; import { useI18n } from "@/lib/i18n"; import type { Activity } from "@/lib/schemas"; import { Button } from "@/components/ui"; import { ActivityHeader, FeedbackPanel, Hint, PromptCard, QuestionText, type ActivityComponentProps, } from "./shared"; type FlashcardActivity = Extract; export function Flashcard({ activity, onAnswered, onNext, isLast, nextLabel }: ActivityComponentProps) { const { t } = useI18n(); const [flipped, setFlipped] = useState(false); const [result, setResult] = useState(null); const settle = (correct: boolean) => { if (result !== null) return; setResult(correct); onAnswered(correct); }; return ( <> {flipped ? t("flashcard.didYouKnow") : t("flashcard.tapToFlip")} {flipped && result === null ? (
) : null} {result !== null ? ( ) : null} ); }