Files
breakpilot-compliance/admin-compliance/components/sdk/advisor/EvidenceSummary.tsx
T
Benjamin Admin 591cae5ebc feat(advisor): Case Workspace v2 — Evidence grouping, human names, 3-column, summary
Reworks the advisor toward a Compliance Case Workspace (review feedback):
- Rename user-facing "Quellen" -> "Evidence".
- Evidence grouped by document/regulation family (count + expandable) — no more
  unsorted DSK/DSK/DPF/... jumble.
- Human-readable regulation names via a display registry (DSK Sdm B51 -> "DSK
  Standard-Datenschutzmodell (SDM)" / Kapitel B51); generic, bridges G2.
- Evidence summary "Antwort basiert auf" with meaningful counts; Regelwerke = distinct
  FAMILIES (fixes the inflated count). NO fabricated trust score (needs a defined basis).
- Expanded mode = 3-column workspace (question+summary | answer | evidence, independent
  scroll) + history switcher; narrow mode stays stacked.
- Prompt: push aggressive markdown structure (## per aspect, numbered phases).

Deferred/coordinated on board: C8 diagrams (RAG contract), answer<->evidence coupling
[1] (needs LLM citation anchors — phase 2), G1 retrieval relevance + G2 metadata (RAG).
tsc clean, 17 vitest, check-loc 0.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-01 10:38:06 +02:00

55 lines
2.0 KiB
TypeScript

'use client'
import { FileText, Hash, Image as ImageIcon, Library } from 'lucide-react'
import type { AdvisorEvidenceMeta } from '@/lib/sdk/advisor/evidence'
import { resolveRegulation } from '@/lib/sdk/advisor/regulation-display'
function Card({
icon,
value,
label,
dim,
}: {
icon: React.ReactNode
value: number
label: string
dim?: boolean
}) {
return (
<div
className={`flex items-center gap-2 rounded-lg border px-2.5 py-1.5 ${
dim ? 'border-gray-100 bg-gray-50' : 'border-gray-200 bg-white'
}`}
>
<span className={dim ? 'text-gray-300' : 'text-indigo-500'}>{icon}</span>
<span>
<span className={`text-sm font-bold ${dim ? 'text-gray-400' : 'text-gray-900'}`}>{value}</span>{' '}
<span className="text-[11px] text-gray-500">{label}</span>
</span>
</div>
)
}
/**
* "Antwort basiert auf" — honest, meaningful counts (not bare badges). Regelwerke = distinct
* document FAMILIES (via resolveRegulation), so multi-part works like the DSK SDM count once.
* No fabricated trust score — a real trust signal needs a defined basis (bindingness/coverage).
*/
export function EvidenceSummary({ meta }: { meta: AdvisorEvidenceMeta }) {
const families = new Set(meta.sources.map((s) => resolveRegulation(s.regulation).familyKey)).size
const cls = 'h-4 w-4'
return (
<div>
<div className="mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-gray-400">
Antwort basiert auf
</div>
<div className="grid grid-cols-2 gap-1.5">
<Card icon={<Library className={cls} />} value={families} label="Regelwerke" />
<Card icon={<FileText className={cls} />} value={meta.sources.length} label="Evidence Units" />
<Card icon={<ImageIcon className={cls} />} value={meta.figures.length} label="Abbildungen" dim={meta.figures.length === 0} />
<Card icon={<Hash className={cls} />} value={meta.footnotes.length} label="Fußnoten" dim={meta.footnotes.length === 0} />
</div>
</div>
)
}