-
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.
[issue-21645-bbb-core] added reply feature to playback chat.
- Loading branch information
Showing
7 changed files
with
109 additions
and
1 deletion.
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
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
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