import { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { fetchChatHistory } from '../store/slices/inboxSlice'; import { Ellipsis, Send } from 'lucide-react'; import { Button, Form } from 'react-bootstrap'; import ChatInput from './ChatInput'; export default function ChatWindow({ onOpenChatDetails }) { const { selectedChat, chatStatus } = useSelector((state) => state.inbox); const [activePlatform, setActivePlatform] = useState('email'); const dispatch = useDispatch(); const [message, setMessage] = useState(''); const platformOptions = [ { name: 'Email', value: 'email', }, { name: 'WhatsApp', value: 'whatsapp', }, ]; const handlePlatformChange = (value) => { setActivePlatform(value); }; useEffect(() => { if (selectedChat) { console.log(selectedChat); } }, [selectedChat]); const handleSendMessage = (e) => { e.preventDefault(); console.log(e.target.message.value); }; return (
avatar
{selectedChat.name}
{platformOptions.map((option) => (
handlePlatformChange(option.value)} > {option.name}
))}
{selectedChat?.chatHistory?.length > 0 && selectedChat?.chatHistory?.map((msg) => (
{msg.content}
))}
setMessage(e.target.value)} />
); }