'use client'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import { JURISDICTION_COLORS, JURISDICTION_LABELS } from '@/lib/constants'; import type { SectionContent } from '@/lib/types'; interface Props { content: SectionContent | null; isLoading: boolean; onClose: () => void; onNodeNavigate: (sectionId: string, jurisdiction: string) => void; onChatAboutSection: (sectionId: string, title: string, docName: string, jurisdiction: string) => void; } export function SectionDrawer({ content, isLoading, onClose, onNodeNavigate, onChatAboutSection, }: Props) { const isOpen = isLoading || content !== null; const color = content ? JURISDICTION_COLORS[content.jurisdiction] ?? '#888' : '#888'; return (
{content ? (
Selected statute {JURISDICTION_LABELS[content.jurisdiction] ?? content.jurisdiction} {content.effective_date ? ( Effective {content.effective_date} ) : null}

Sec {content.section_id} / {content.title}

{content.doc_name}

{content.source_url ? ( View PDF ) : null}
) : null} {isLoading ? (
{[0, 1, 2].map(i => ( ))} Loading section
) : null} {!isLoading && content ? ( <>
{content.chunks.map((chunk, index) => (
0 ? 'mt-6 border-t border-white/[0.05] pt-6' : ''}>

{children}

, ul: ({ children }) =>
    {children}
, ol: ({ children }) =>
    {children}
, li: ({ children }) =>
  • {children}
  • , strong: ({ children }) => {children}, table: ({ children }) => (
    {children}
    ), thead: ({ children }) => {children}, tbody: ({ children }) => {children}, th: ({ children }) => {children}, td: ({ children }) => {children}, code: ({ children, className }) => ( {children} ), }} > {chunk.text}
    ))}
    ) : null}
    ); }