'use client'; import { useEffect, useRef } from 'react'; import { MessageBubble } from '@/components/MessageBubble'; import type { ChatMessage } from '@/lib/types'; const EXAMPLE_QUERIES = [ 'What are promoter obligations under RERA?', 'What penalty applies for delayed possession?', 'How does agent registration work under Maharashtra rules?', 'What is the complaint filing process for a buyer?', ] as const; interface Props { messages: ChatMessage[]; isLoading: boolean; onExampleClick: (query: string) => void; } export function ChatThread({ messages, isLoading, onExampleClick }: Props) { const bottomRef = useRef(null); useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages, isLoading]); if (messages.length === 0 && !isLoading) { return (

Research desk

Ask the ledger a legal question.

Query Indian RERA provisions, compare jurisdictions, and route selected graph sections directly into the chat.

{EXAMPLE_QUERIES.map(query => ( ))}
); } return (
{messages.map(message => ( ))} {isLoading ? (
) : null}
); }