import React from 'react'; import { Send, User, Bot } from 'lucide-react'; import InsuCompassLogo from '../../assets/InsuCompass_Logo.png'; import ReactMarkdown from 'react-markdown'; import { useChatInterface } from './useChatInterface'; import { Plan, UserProfile } from '../../interface'; const PlanCard: React.FC<{ plan: Plan }> = ({ plan }) => (

{plan.plan_name}

{plan.plan_type}

{plan.reasoning}

Estimated Premium: {plan.estimated_premium}

); interface ChatInterfaceScreenProps { userProfile: UserProfile; } const ChatInterfaceScreen: React.FC = ({ userProfile }) => { const { chatHistory, isLoading, currentMessage, setCurrentMessage, handleSendMessage, showPlanRecs, chatEndRef, inputRef } = useChatInterface(userProfile); return (
{/* Header */}
InsuCompass Logo

InsuCompass

Chat with your AI insurance advisor

{/* Chat Messages */}
{chatHistory.map((message, index) => (
{/* Avatar */}
{message.role === 'user' ? ( ) : ( )}
{/* Message Bubble */}
{message.role === 'user' ? 'You' : 'InsuCompass AI'}
{message.content} {showPlanRecs && message.plans?.length && ( <>

Recommended Plans for You

{message.plans?.map((plan, idx) => ( ))}
)}
))} {/* Loading indicator */} {isLoading && (
)}
{/* Message Input */}
setCurrentMessage(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && handleSendMessage()} placeholder="Type your message..." className="w-full px-4 py-3 pr-12 border border-gray-300 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors" disabled={isLoading} />
); }; export default ChatInterfaceScreen;