import React, { useRef, useEffect } from 'react'; import { MessageCard } from './MessageCard'; import type { Message } from '../types/chat'; import { Scale, Sparkles, Code, FileText, Shield, Loader2 } from 'lucide-react'; interface ChatAreaProps { messages: Message[]; onSendMessage: (text: string) => void; onRegenerate: () => void; onOpenPDFPreview: (pdf: NonNullable) => void; onEditMessage?: (id: string, text: string) => void; onDeleteMessage?: (id: string) => void; isGenerating?: boolean; } export const ChatArea: React.FC = ({ messages, onSendMessage, onRegenerate, onOpenPDFPreview, onEditMessage, onDeleteMessage, isGenerating }) => { const bottomRef = useRef(null); useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages, isGenerating]); if (messages.length === 0) { return (
{/* Logo & Header */}

Welcome to LawSLM

Your Intelligent AI Legal and General Assistant — Built completely from scratch by Amit Kumar.

{/* 4 Feature Suggestion Cards */}
} title="Legal Information" subtitle="Explain statutes, IPC section provisions & legal procedures" onClick={() => onSendMessage("Explain Section 420 of IPC in simple terms")} /> } title="PDF Report Export" subtitle="Generate & export formal legal notices & affidavit documents" onClick={() => onSendMessage("Generate formal legal notice PDF report")} /> } title="Programming & AI" subtitle="Write & debug Python, PyTorch, C++, Java & SQL code" onClick={() => onSendMessage("Write a Python script to train a Transformer in PyTorch")} /> } title="Model Creator" subtitle="Learn about LawSLM's architecture and developer" onClick={() => onSendMessage("Who created you?")} />
); } return (
{messages.map((msg, idx) => ( ))} {/* Animated Thinking Indicator */} {isGenerating && messages[messages.length - 1]?.role === 'user' && (
LawSLM is thinking...
)}
); }; interface SuggestionCardProps { icon: React.ReactNode; title: string; subtitle: string; onClick: () => void; } const SuggestionCard: React.FC = ({ icon, title, subtitle, onClick }) => ( );