import React from 'react'; import { useRecoilValue } from 'recoil'; import { useMessageProcess } from '~/hooks'; import type { TMessageProps } from '~/common'; import MessageRender from './ui/MessageRender'; import MultiMessage from './MultiMessage'; import { cn } from '~/utils'; import store from '~/store'; const MessageContainer = React.memo( ({ handleScroll, children, }: { handleScroll: (event?: unknown) => void; children: React.ReactNode; }) => { return (
{children}
); }, ); export default function Message(props: TMessageProps) { const { showSibling, conversation, handleScroll, siblingMessage, latestMultiMessage, isSubmittingFamily, } = useMessageProcess({ message: props.message }); const { message, currentEditId, setCurrentEditId } = props; const maximizeChatSpace = useRecoilValue(store.maximizeChatSpace); if (!message || typeof message !== 'object') { return null; } const { children, messageId = null } = message; return ( <> {showSibling ? (
) : (
)}
); }