components.message.MessageBody.js Maven / Gradle / Ivy
import {
Box,
Card
} from '@mui/material';
import MessageInfo from 'components/message/MessageInfo';
import MessageAttachments from 'components/message/Attachments';
import Types from 'types/types';
import { RenderValue } from 'components/render';
const convertToFileRefs = (attachments) => {
if (Array.isArray(attachments) && attachments.length > 0 && attachments[0].__typename == "ContentRef") {
return attachments.map(attachment => ({...attachment, __id: attachment.id || attachment.__id, __kind: "content-ref"}))
} else return attachments
}
const MessageBody = (message) => {
const attachments = Types.asFileRefs(convertToFileRefs(message.attachments))
return (
< MessageAttachments fileRefs={attachments}/>
)
}
const MessageContents = ({body}) => {
return (
{body}
)
}
export default MessageBody