'use client' import { useState } from 'react' import { ChevronDown, ChevronRight, ExternalLink } from 'lucide-react' import type { EvidenceUnit } from '@/lib/sdk/advisor/contract' import { resolveRegulation } from '@/lib/sdk/advisor/regulation-display' /** One evidence unit (contract shape). Compact inside a document group: chapter/section only. */ export function EvidenceUnitCard({ unit, compact, highlighted, }: { unit: EvidenceUnit compact?: boolean highlighted?: boolean }) { const [open, setOpen] = useState(false) const d = resolveRegulation({ code: unit.document, short: unit.document }) const crumbs = [unit.section, unit.paragraph].filter((x): x is string => Boolean(x)) const canOpen = !!unit.url && /^https?:\/\//i.test(unit.url) const header = compact ? (d.chapter ? `Kapitel ${d.chapter}` : crumbs[0] || d.familyLabel) : d.familyLabel const sub = compact && !d.chapter && crumbs.length ? crumbs.slice(1) : crumbs return (
{unit.snippet}
)}