-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #286 from GuiLeme/issue-21645-bbb-core
feat: add chat features to the recordings - Issue 21645 bbb core
- Loading branch information
Showing
11 changed files
with
254 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import cx from 'classnames'; | ||
import './index.scss'; | ||
|
||
const sortByCount = (r1, r2) => r2.number - r1.number; | ||
|
||
const ChatMessageReactions = (props) => { | ||
const { | ||
reactions, | ||
active, | ||
} = props; | ||
|
||
if (reactions.length === 0) return null; | ||
return ( | ||
<div | ||
className='reactions-wrapper' | ||
> | ||
{reactions.sort(sortByCount).map((details) => ( | ||
<span | ||
className={cx('emoji-wrapper', { inactive: !active })} | ||
> | ||
<em-emoji | ||
size={parseFloat( | ||
window.getComputedStyle(document.documentElement).fontSize, | ||
)} | ||
>{details.emoji}</em-emoji> | ||
<span>{details.count}</span> | ||
</span> | ||
) | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ChatMessageReactions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@import 'src/styles/sizes'; | ||
|
||
:root { | ||
--emoji-wrapper-border-color: var(--gray-lightest); | ||
--emoji-wrapper-border-color-hover: var(--gray-lighter); | ||
} | ||
|
||
.reactions-wrapper { | ||
display: flex; | ||
flex-wrap: wrap; | ||
margin-top: 0.25rem; | ||
user-select: none; | ||
} | ||
|
||
.emoji-wrapper { | ||
background: none; | ||
border-radius: 1rem; | ||
padding: 0.375rem 1rem; | ||
line-height: 1; | ||
display: flex; | ||
flex-wrap: nowrap; | ||
border: 1px solid var(--emoji-wrapper-border-color); | ||
margin-right: 0.25rem; | ||
|
||
em-emoji { | ||
[dir='ltr'] & { | ||
margin-right: 0.25rem; | ||
} | ||
|
||
[dir='rtl'] & { | ||
margin-left: 0.25rem; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import cx from 'classnames'; | ||
import '../index.scss'; | ||
|
||
const propTypes = { | ||
active: PropTypes.bool, | ||
idToReference: PropTypes.string, | ||
text: PropTypes.string, | ||
}; | ||
|
||
const defaultProps = { | ||
active: false, | ||
idToReference: '', | ||
text: '', | ||
}; | ||
|
||
const Reply = ({ | ||
active, | ||
idToReference, | ||
scrollTo, | ||
text, | ||
}) => { | ||
|
||
const handleClickReply = () => { | ||
const messageReplied = document.getElementById(idToReference); | ||
scrollTo(messageReplied); | ||
messageReplied.classList.add('highlight') | ||
setTimeout(() => | ||
messageReplied.classList.remove('highlight'), 800 | ||
); | ||
} | ||
|
||
return ( | ||
<span | ||
onClick={handleClickReply} | ||
className={cx('reply-tag', {inactive: !active})} | ||
> | ||
{text} | ||
</span> | ||
); | ||
}; | ||
|
||
Reply.propTypes = propTypes; | ||
Reply.defaultProps = defaultProps; | ||
|
||
// Checks the message active state | ||
const areEqual = (prevProps, nextProps) => { | ||
if (prevProps.active !== nextProps.active) return false; | ||
|
||
return true; | ||
}; | ||
|
||
export default React.memo(Reply, areEqual); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.