import { useParams } from '@tanstack/react-router'; import { useDocument } from '../api/hooks'; import { StatusBadge, ConfidenceBar, LoadingSpinner, Card } from '../components/ui'; export function DocumentDetailPage() { const { id } = useParams({ from: '/documents/$id' }); const { data: doc, isLoading } = useDocument(id); if (isLoading || !doc) return ; return (

{doc.title ?? 'Untitled Document'}

{doc.document_type} {doc.source_type} {doc.publisher && {doc.publisher}} {doc.published_at && {new Date(doc.published_at).toLocaleString()}}
{/* Metadata */}

Metadata

URL
{doc.url ? {doc.url} : '—'}
Language
{doc.language ?? '—'}
Content Hash
{doc.content_hash ?? '—'}
Parse Quality
{doc.parse_quality_score?.toFixed(2) ?? '—'}
Parse Confidence
Retrieved
{doc.retrieved_at ? new Date(doc.retrieved_at).toLocaleString() : '—'}
{/* Company Mentions */} {doc.company_mentions.length > 0 && (

Company Mentions

{doc.company_mentions.map((m, i) => ( {m.ticker} {m.legal_name} ({m.mention_type}, {(m.confidence * 100).toFixed(0)}%) ))}
)} {/* Intelligence Extraction */} {doc.intelligence ? (

Intelligence Extraction

Summary

{doc.intelligence.summary ?? '—'}

Confidence
Validation
Model
{doc.intelligence.model_name ?? '—'} ({doc.intelligence.prompt_version})
{doc.intelligence.macro_themes && doc.intelligence.macro_themes.length > 0 && (
Macro Themes
{doc.intelligence.macro_themes.map((t, i) => ( {t} ))}
)} {doc.intelligence.extraction_warnings && doc.intelligence.extraction_warnings.length > 0 && (
Warnings
{doc.intelligence.extraction_warnings.map((w, i) => ( {w} ))}
)} {/* Company Impacts */} {doc.intelligence.company_impacts && doc.intelligence.company_impacts.length > 0 && (
Company Impacts
{doc.intelligence.company_impacts.map((imp, i) => (
{imp.ticker} {imp.catalyst_type} {imp.impact_horizon}
{imp.key_facts && imp.key_facts.length > 0 && (
Key Facts
    {imp.key_facts.map((f, j) =>
  • {f}
  • )}
)} {imp.risks && imp.risks.length > 0 && (
Risks
    {imp.risks.map((r, j) =>
  • {r}
  • )}
)}
))}
)}
) : (

No intelligence extraction available

)} {/* Storage References */}

Storage References

Raw:
{doc.raw_storage_ref ?? '—'}
Normalized:
{doc.normalized_storage_ref ?? '—'}
); }