"use client" import { AlertOctagon, AlertTriangle, ExternalLink, Info } from "lucide-react" import type { KnownIssue } from "@/lib/known-issues" interface KnownIssuesPanelProps { issues: KnownIssue[] /** * "compact" — single-line summary chip suitable for surfacing at the top of * the policy overview. "full" — full bordered list with descriptions. */ variant?: "compact" | "full" } const SEVERITY_ACCENT: Record = { info: "var(--accent)", warning: "oklch(0.65 0.14 75)", critical: "var(--destructive)", } const SEVERITY_STYLE: Record; label: string }> = { info: { Icon: Info, label: "Note" }, warning: { Icon: AlertTriangle, label: "Known issue" }, critical: { Icon: AlertOctagon, label: "Critical issue" }, } export function KnownIssuesPanel({ issues, variant = "full" }: KnownIssuesPanelProps) { if (issues.length === 0) return null const sorted = [...issues].sort((a, b) => severityRank(b.severity) - severityRank(a.severity)) const headlineSeverity = sorted[0].severity const Style = SEVERITY_STYLE[headlineSeverity] const Icon = Style.Icon const accent = SEVERITY_ACCENT[headlineSeverity] if (variant === "compact") { return (
{issues.length} known issue{issues.length === 1 ? "" : "s"} documented — see below for detail.
) } return (
Known issues with this benchmark
    {sorted.map((issue, idx) => { const S = SEVERITY_STYLE[issue.severity] const I = S.Icon const a = SEVERITY_ACCENT[issue.severity] return (
  • {S.label} {issue.title}

    {issue.summary}

    {(issue.source_url || issue.published) && (
    {issue.source_url && ( Source )} {issue.published && Published {issue.published}}
    )}
  • ) })}
) } function severityRank(s: KnownIssue["severity"]): number { if (s === "critical") return 3 if (s === "warning") return 2 return 1 }