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

89 lines
1.9 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: {
id: 'app.actionsBar.interactions.raiseHand',
description: 'raise Hand Label',
},
notRaiseHandLabel: {
id: 'app.actionsBar.interactions.lowHand',
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);
};
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>
<Emoji key={id} emoji={{ id }} size={30} onClick={() => onReactionSelect(native)} />
</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-06-14 01:51:42 +08:00
<Emoji key='hand' emoji={{ id: 'hand' }} size={30} />
{RaiseHandButtonLabel()}
</Styled.RaiseHandButtonWrapper>
</Styled.Wrapper>
);
};
ReactionsPicker.propTypes = propTypes;
export default injectIntl(ReactionsPicker);