import { Children, createContext, useEffect, useState } from 'react'; import { Tabs } from 'antd'; import { MailFilled, MailOutlined, WhatsAppOutlined } from '@ant-design/icons'; import InputComposer from './Input/InputComposer'; import EmailComposer from './Input/EmailChannelTab'; import { WABIcon } from '@/components/Icons'; import useConversationStore from '@/stores/ConversationStore'; import { useShallow } from 'zustand/react/shallow'; const DEFAULT_CHANNEL = 'waba'; const ReplyWrapper = ({ ...props }) => { const [activeChannel, setActiveChannel] = useState(DEFAULT_CHANNEL); const onChannelTabsChange = (activeKey) => { setActiveChannel(activeKey); }; const activeMessages = useConversationStore( useShallow((state) => (state.currentConversation.sn && state.activeConversations[state.currentConversation.sn] ? state.activeConversations[state.currentConversation.sn] : [])) ); useEffect(() => { const len = activeMessages.length; const thisLastChannel = activeMessages.length > 0 ? activeMessages[len - 1]?.type : DEFAULT_CHANNEL; setActiveChannel(thisLastChannel); return () => {}; }, [activeMessages]); const replyTypes = [ { key: 'waba', label: 'WABA-Global Highlights', icon: , children: }, { key: 'email', label: 'Email', icon: , children: }, { key: 'whatsapp', label: 'WhatsApp', icon: , children: }, ]; return (
); }; export default ReplyWrapper;