SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
1.3 KB · 53 lines tsx
Raw Blame History
1'use client';2import type { ReactNode } from 'react';3import { cn } from '@/lib/cn';4import type { ProvenanceEntry } from '@/lib/types';5import { useEvidence } from './evidence-context';67/**8 * Trigger wrapper: renders its children as a subtle dotted-underline button that opens the evidence drawer for9 * `<slug>.<property>`. Server components can use it (it is a client leaf that only needs serialisable props).10 * `data-evidence` is the QA hook.11 */12export function Evidence({13  slug,14  property,15  value,16  display,17  unit,18  label,19  fallback,20  entity,21  children,22  className,23  title = 'Show evidence: source, tier, observation time, extractor',24}: {25  slug: string;26  property: string;27  value?: unknown;28  display?: string;29  unit?: string | null;30  label?: string;31  fallback?: ProvenanceEntry | null;32  entity?: { name?: string; entity_type?: string } | null;33  children: ReactNode;34  className?: string;35  title?: string;36}) {37  const { open } = useEvidence();38  return (39    <button40      type="button"41      className={cn('evidence', className)}42      data-evidence={`${slug}:${property}`}43      title={title}44      onClick={(e) => {45        e.stopPropagation();46        open({ slug, property, value, display, unit, label, fallback: fallback ?? null, entity: entity ?? null });47      }}48    >49      {children}50    </button>51  );52}53