bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/emoji-picker/reactions-bar/component.jsx

94 lines
2.0 KiB
React
Raw Normal View History

2023-06-14 01:51:42 +08:00
import React from 'react';
import PropTypes from 'prop-types';
import { injectIntl, defineMessages } from 'react-intl';
import { Emoji } from 'emoji-mart';
import 'emoji-mart/css/emoji-mart.css';
import Styled from './styles';
const propTypes = {
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
onEmojiSelect: PropTypes.func.isRequired,
};
const intlMessages = defineMessages({
raiseHandLabel: {
2023-07-18 19:54:36 +08:00
id: 'app.actionsBar.reactions.raiseHand',
2023-06-14 01:51:42 +08:00
description: 'raise Hand Label',
},
notRaiseHandLabel: {
2023-07-18 19:54:36 +08:00
id: 'app.actionsBar.reactions.lowHand',
2023-06-14 01:51:42 +08:00
description: 'not Raise Hand Label',
},
});
const reactions = [
{
2023-06-23 20:42:54 +08:00
id: 'smiley',
native: '😃',
2023-06-14 01:51:42 +08:00
},
{
id: 'neutral_face',
native: '😐',
},
{
id: 'slightly_frowning_face',
native: '🙁',
},
{
id: '+1',
native: '👍',
},
{
id: '-1',
native: '👎',
},
{
id: 'clap',
native: '👏',
},
];
const ReactionsPicker = (props) => {
const {
intl,
onReactionSelect,
2023-06-27 20:50:04 +08:00
onRaiseHand,
raiseHand,
2023-06-27 22:08:49 +08:00
isMobile,
2023-06-14 01:51:42 +08:00
} = props;
const RaiseHandButtonLabel = () => {
2023-06-27 22:08:49 +08:00
if (isMobile) return null;
return raiseHand
2023-06-14 01:51:42 +08:00
? intl.formatMessage(intlMessages.notRaiseHandLabel)
: intl.formatMessage(intlMessages.raiseHandLabel);
};
2023-07-20 03:33:28 +08:00
const emojiProps = {
native: true,
size: '1.5rem',
};
2023-06-14 01:51:42 +08:00
return (
2023-06-27 22:08:49 +08:00
<Styled.Wrapper isMobile={isMobile}>
2023-06-14 01:51:42 +08:00
{reactions.map(({ id, native }) => (
<Styled.ButtonWrapper>
2023-07-20 03:33:28 +08:00
<Emoji key={id} emoji={{ id }} onClick={() => onReactionSelect(native)} {...emojiProps} />
2023-06-14 01:51:42 +08:00
</Styled.ButtonWrapper>
))}
2023-06-27 22:08:49 +08:00
<Styled.Separator isMobile={isMobile} />
2023-06-27 20:50:04 +08:00
<Styled.RaiseHandButtonWrapper onClick={() => onRaiseHand()} active={raiseHand}>
2023-07-20 03:33:28 +08:00
<Emoji key='hand' emoji={{ id: 'hand' }} {...emojiProps} />
2023-06-14 01:51:42 +08:00
{RaiseHandButtonLabel()}
</Styled.RaiseHandButtonWrapper>
</Styled.Wrapper>
);
};
ReactionsPicker.propTypes = propTypes;
export default injectIntl(ReactionsPicker);