import type { Output, Scores } from "@/lib/types"; const VARIANT_LABEL: Record = { headline: "Headline", body: "Body", cta: "CTA", }; // Badge / accent color by weighted average: green >=4.0, amber 2.5-4.0, red <2.5. function band(weighted: number) { if (weighted >= 4.0) { return { text: "text-emerald-400", border: "border-emerald-500/40", bg: "bg-emerald-500/10", bar: "bg-emerald-400/70" }; } if (weighted >= 2.5) { return { text: "text-amber-400", border: "border-amber-500/40", bg: "bg-amber-500/10", bar: "bg-amber-400/70" }; } return { text: "text-red-400", border: "border-red-500/40", bg: "bg-red-500/10", bar: "bg-red-400/70" }; } const DIMS: { key: keyof Scores; label: string }[] = [ { key: "hook_strength", label: "Hook" }, { key: "brand_alignment", label: "Brand" }, { key: "clarity", label: "Clarity" }, { key: "conversion_intent", label: "Conv" }, ]; function ScoreBar({ label, value, barClass }: { label: string; value: number; barClass: string }) { const pct = Math.max(0, Math.min(100, (value / 5) * 100)); return (
{label}
{value}
); } export function ResultCard({ output }: { output: Output }) { const { scores } = output; const c = band(scores.weighted_average); return (
{VARIANT_LABEL[output.variant_type]} {scores.weighted_average.toFixed(2)}

{output.content}

{DIMS.map((d) => ( ))}
); }