"use client";
import { ClipboardCheck } from "lucide-react";
import type { BrainAnswerCorrectionOutput } from "@/lib/api/types";
import type { StudyCardMeta } from "./types";
export function AnswerCorrectionCard({
data,
topic,
meta,
}: {
data: BrainAnswerCorrectionOutput;
topic: string;
meta?: StudyCardMeta;
}) {
const isSourceMismatch = data.source_truth.toLowerCase().includes("not found");
return (
Answer Correction
{topic}
{/* Score + rubric */}
{data.score}
{data.mark_scheme_assumption}
{/* What you wrote correctly */}
{data.what_correct.length > 0 && (
)}
{/* Marks lost */}
{/* Missing keywords */}
{data.missing_keywords.length > 0 && (
)}
{/* Corrected board-answer version */}
Corrected board-answer version
{data.corrected_board_answer}
{/* How to improve */}
{data.how_to_improve.length > 0 && (
)}
{/* Quick retry task */}
{data.quick_retry_task && (
Quick retry task
{data.quick_retry_task}
)}
{/* Source truth */}
{data.source_truth}
{/* Source evidence */}
{data.source_evidence.length > 0 && (
Source evidence
{data.source_evidence.map((evidence, i) => (
{evidence}
))}
)}
{meta?.evidenceLabel ? (
{meta.evidenceLabel}
) : null}
);
}
function Section({
title,
items,
variant = "default",
}: {
title: string;
items: string[];
variant?: "default" | "caution" | "action" | "keywords";
}) {
const variantStyles = {
default: "border-white/[0.06] bg-white/[0.02]",
caution: "border-amber-500/10 bg-amber-500/[0.03]",
action: "border-white/[0.1] bg-white/[0.04]",
keywords: "border-blue-500/10 bg-blue-500/[0.03]",
};
const dotStyles = {
default: "bg-white/30",
caution: "bg-amber-400/50",
action: "bg-white/45",
keywords: "bg-blue-400/50",
};
return (
{title}
{items.map((item, i) => (
-
{item}
))}
);
}