"use client"; import { useState } from "react"; import { Button } from "@/components/ui"; import { useI18n } from "@/lib/i18n"; import type { HomeworkCheckRecord } from "@/lib/schemas"; import { CopyButton } from "./CopyButton"; import { FollowUpBar } from "./FollowUpBar"; /** Mode 3 result: verdict, what's right, what needs fixing, corrected version. */ export function HomeworkCheckResult({ record, onAgain, onNew, onToDeck, againLoading, }: { record: HomeworkCheckRecord; onAgain: () => void; onNew: () => void; onToDeck: () => void; againLoading: boolean; }) { const { t } = useI18n(); const [corrected, setCorrected] = useState(record.corrected); return (

{t("homework.check.title")}

{record.title}

{t("homework.check.verdict")}

{record.verdict}

{record.correct.length > 0 ? (

{t("homework.check.correct")}

) : null} {record.wrong.length > 0 ? (

{t("homework.check.wrong")}

) : null}

{t("homework.check.corrected")}

{corrected}

setCorrected(record.corrected)} canRestore={corrected !== record.corrected} />

{t("homework.toDeckNote")}

); }