'use client' import { useState } from 'react' import { ChevronDown, ChevronRight, Library } from 'lucide-react' import type { KnowledgeUnit } from '@/lib/sdk/advisor/evidence' import { resolveRegulation } from '@/lib/sdk/advisor/regulation-display' import { KnowledgeUnitCard } from './KnowledgeUnitCard' import { PaneHeader } from './PaneHeader' interface EvidenceGroupData { key: string label: string units: KnowledgeUnit[] } function groupByFamily(sources: KnowledgeUnit[]): EvidenceGroupData[] { const map = new Map() for (const u of sources) { const d = resolveRegulation(u.regulation) const g = map.get(d.familyKey) ?? { key: d.familyKey, label: d.familyLabel, units: [] } g.units.push(u) map.set(d.familyKey, g) } return [...map.values()].sort((a, b) => b.units.length - a.units.length) } function EvidenceGroup({ group }: { group: EvidenceGroupData }) { const [open, setOpen] = useState(group.units.length <= 3) return (
{open && (
{group.units.map((u) => ( ))}
)}
) } /** Evidence pane — retrieved units grouped by document/regulation family, count + expandable. */ export function EvidencePane({ sources }: { sources: KnowledgeUnit[] }) { const groups = groupByFamily(sources) return (
} title="Evidence" count={sources.length} /> {groups.length === 0 ? (

Keine strukturierte Evidence zu dieser Antwort.

) : (
{groups.map((g) => ( ))}
)}
) }