import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; import newChatIcon from '../assets/openNewChat.svg'; import ShareIcon from '../assets/share.svg'; import { ShareConversationModal } from '../modals/ShareConversationModal'; import { useState } from 'react'; import { selectConversationId } from '../preferences/preferenceSlice'; import { useDispatch } from 'react-redux'; import { AppDispatch } from '../store'; import { setConversation, updateConversationId, } from '../conversation/conversationSlice'; interface ActionButtonsProps { className?: string; showNewChat?: boolean; showShare?: boolean; } export default function ActionButtons({ className = '', showNewChat = true, showShare = true, }: ActionButtonsProps) { const { t } = useTranslation(); const dispatch = useDispatch(); const conversationId = useSelector(selectConversationId); const [isShareModalOpen, setShareModalState] = useState(false); const newChat = () => { dispatch(setConversation([])); dispatch( updateConversationId({ query: { conversationId: null }, }), ); }; return (
{showNewChat && ( )} {showShare && conversationId && ( <> {isShareModalOpen && ( setShareModalState(false)} conversationId={conversationId} /> )} )}
{/* */}
); }