diff --git a/.gitignore b/.gitignore index 3ea4a624b..e7ba4d641 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,7 @@ node_modules !.yarn/sdks !.yarn/versions - .babelrc .vscode - diff --git a/packages/react/src/components/Message/MessageDivider.js b/packages/react/src/components/Message/MessageDivider.js index 73698ef5d..2e326fdc7 100644 --- a/packages/react/src/components/Message/MessageDivider.js +++ b/packages/react/src/components/Message/MessageDivider.js @@ -1,6 +1,5 @@ import { css } from '@emotion/react'; import React from 'react'; -import PropTypes from 'prop-types'; import { appendClassNames } from '../../lib/appendClassNames'; import useComponentOverrides from '../../theme/useComponentOverrides'; @@ -74,10 +73,3 @@ export const MessageDivider = ({ ); }; - -MessageDivider.propTypes = { - children: PropTypes.node, - unreadLabel: PropTypes.string, -}; - -export default MessageDivider; diff --git a/packages/react/src/components/Message/MessageReactions.js b/packages/react/src/components/Message/MessageReactions.js index 036bde341..216ef91c7 100644 --- a/packages/react/src/components/Message/MessageReactions.js +++ b/packages/react/src/components/Message/MessageReactions.js @@ -1,6 +1,5 @@ import React from 'react'; import { css } from '@emotion/react'; -import PropTypes from 'prop-types'; import useComponentOverrides from '../../theme/useComponentOverrides'; import { Box } from '../Box'; import { appendClassNames } from '../../lib/appendClassNames'; @@ -84,11 +83,3 @@ export const MessageReactions = ({ ); }; - -MessageReactions.propTypes = { - message: PropTypes.object, - authenticatedUserUsername: PropTypes.string, - handleEmojiClick: PropTypes.func, -}; - -export default MessageReactions; diff --git a/packages/react/src/components/Message/index.js b/packages/react/src/components/Message/index.js index 1760a86d4..b0e7e95e8 100644 --- a/packages/react/src/components/Message/index.js +++ b/packages/react/src/components/Message/index.js @@ -1,3 +1 @@ export { default as Message } from './Message'; -export { default as MessageReactions } from './MessageReactions'; -export { default as MessageDivider } from './MessageDivider'; diff --git a/packages/react/src/components/SearchMessage/SearchMessage.js b/packages/react/src/components/SearchMessage/SearchMessage.js index b692ebc58..756487b13 100644 --- a/packages/react/src/components/SearchMessage/SearchMessage.js +++ b/packages/react/src/components/SearchMessage/SearchMessage.js @@ -1,14 +1,19 @@ import React, { useState, useContext } from 'react'; import { isSameDay, format } from 'date-fns'; +import { + Message, + MessageReactions, + MessageDivider, +} from '@rocket.chat/fuselage'; import RCContext from '../../context/RCInstance'; import classes from './SearchMessage.module.css'; import { Markdown } from '../Markdown/index'; import { useUserStore, useSearchMessageStore } from '../../store'; +import { isSameUser, serializeReactions } from '../../lib/reaction'; import { Button } from '../Button'; import { Box } from '../Box'; import { Icon } from '../Icon'; import { ActionButton } from '../ActionButton'; -import { Message, MessageReactions, MessageDivider } from '../Message'; const Search = () => { const { RCInstance } = useContext(RCContext); @@ -72,23 +77,38 @@ const Search = () => { const prev = arr[index + 1]; const newDay = isMessageNewDay(msg, prev); return ( - - {newDay && ( - - {format(new Date(msg.ts), 'MMMM d, yyyy')} - - )} - - + + + {newDay && ( + + {format(new Date(msg.ts), 'MMMM d, yyyy')} + + )} + + {msg.u.username} + + {format(new Date(msg.ts), 'h:mm a')} + + {msg.editedAt && ( + + )} + + + + + + {msg.reactions && + serializeReactions(msg.reactions).map((reaction) => ( + + +

{reaction.count}

+
+ ))} +
+
); })}