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}
{plan.key_features.map((feat, i) => (
- {feat}
))}
);
interface ChatInterfaceScreenProps {
userProfile: UserProfile;
}
const ChatInterfaceScreen: React.FC = ({ userProfile }) => {
const {
chatHistory,
isLoading,
currentMessage,
setCurrentMessage,
handleSendMessage,
showPlanRecs,
chatEndRef,
inputRef
} = useChatInterface(userProfile);
return (
{/* Header */}
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 */}
);
};
export default ChatInterfaceScreen;