'use client' /** * Data-room / OpenFrame-docs inline chat card. * * PURE PRESENTATION. The card receives a pre-composed `` prop bundle * (`anchorProps`) plus a pre-resolved badge label — both decisions * (URL composition + cross-app routing) are made in the consumer's * runtime layer, not inside this card. * * Renders `[card://data_room_doc:]` and `[card://markdown:]` markers * — both use this card because their viewer surface is structurally * identical; only the `baseRoute` differs (`/data-room` vs `/knowledge-base`). */ import React from 'react' import { ExternalLink } from 'lucide-react' import { StatusBadge } from '../../ui/status-badge' import { COMPACT_CARD_OUTER, COMPACT_CARD_OUTER_STATIC, COMPACT_CARD_SKELETON_OUTER, COMPACT_CARD_TEXT_COL, COMPACT_CARD_TITLE, } from '../utils/compact-card-classes' import type { DataRoomDocCardItem } from '../types/entities/data-room-doc' export interface DataRoomDocCardAnchorProps { href: string target?: '_blank' rel?: 'noopener noreferrer' onClick?: (e: React.MouseEvent) => void } export interface DataRoomDocCardProps { item: DataRoomDocCardItem className?: string /** Pre-composed badge label. REQUIRED — the consumer resolves * `sourceRepo` against its `SOURCE_LABELS_BY_TABLE` registry and * passes the result here. * * Why required (no default): if the badge silently defaulted to a * literal like "Data room", a card sourced from openframe-docs (or * any other repo) whose `sourceRepo` resolution failed would * display the wrong provenance label — a real security signal, * because "Data Room" implies private/internal documents to * end-users. Forcing the consumer to supply the label means a * bug at the resolution step surfaces as a TypeScript error * ("badgeText required") instead of a falsely-labeled production * card. The hub-side dispatcher already passes * `getSourceLabel(sourceRepo)` with a non-null fallback. */ badgeText: string /** Pre-composed `` prop bundle. When provided, the outer renders * as ``; otherwise the card is non-interactive. */ anchorProps?: DataRoomDocCardAnchorProps } export function DataRoomDocCard({ item, className, badgeText, anchorProps }: DataRoomDocCardProps) { const body = ( <> {item.title} {item.path ? ( Path: {item.path} ) : null} {item.preview ? ( {item.preview} ) : null} {anchorProps?.href ? ( ) : null} ) if (!anchorProps) { return ( {body} ) } return ( {body} ) } export function DataRoomDocCardSkeleton({ className }: { className?: string }) { return ( ) }