import React from 'react'; import { MarkdownAST } from '@rocket.chat/message-parser'; import isEmpty from 'lodash/isEmpty'; import Quote from './Quote'; import Paragraph from './Paragraph'; import Heading from './Heading'; import Code from './Code'; import BigEmoji from './BigEmoji'; import OrderedList from './OrderedList'; import UnorderedList from './UnorderedList'; import { IUserMention, IUserChannel, TOnLinkPress } from '../interfaces'; import TaskList from './TaskList'; import MarkdownContext from './MarkdownContext'; import LineBreak from './LineBreak'; import { KaTeX } from './Katex'; interface IBodyProps { tokens?: MarkdownAST; mentions?: IUserMention[]; channels?: IUserChannel[]; getCustomEmoji?: Function; onLinkPress?: TOnLinkPress; navToRoomInfo?: Function; useRealName?: boolean; username: string; } const Body = ({ tokens, mentions, channels, useRealName, username, navToRoomInfo, getCustomEmoji, onLinkPress }: IBodyProps): React.ReactElement | null => { if (isEmpty(tokens)) { return null; } return ( {tokens?.map(block => { switch (block.type) { case 'BIG_EMOJI': return ; case 'UNORDERED_LIST': return ; case 'ORDERED_LIST': return ; case 'TASKS': return ; case 'QUOTE': return ; case 'PARAGRAPH': return ; case 'CODE': return ; case 'HEADING': return ; case 'LINE_BREAK': return ; // This prop exists, but not even on the web it is treated, so... // https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/gazzodown/src/Markup.tsx // case 'LIST_ITEM': // return ; case 'KATEX': return ; default: return null; } })} ); }; export default Body;