import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { defineMessages } from 'react-intl'; import withShortcutHelper from '/imports/ui/components/shortcut-help/service'; import BBBMenu from '/imports/ui/components/common/menu/component'; import Button from '/imports/ui/components/common/button/component'; import Styled from './styles'; import { EMOJI_STATUSES } from '/imports/utils/statuses'; const propTypes = { intl: PropTypes.shape({ formatMessage: PropTypes.func.isRequired, }).isRequired, shortcuts: PropTypes.objectOf(PropTypes.string), }; const defaultProps = { shortcuts: {}, }; const intlMessages = defineMessages({ statusTriggerLabel: { id: 'app.actionsBar.emojiMenu.statusTriggerLabel', description: 'label for option to show emoji menu', }, clearStatusLabel: { id: 'app.actionsBar.emojiMenu.noneLabel', description: 'label for status clearing', }, raiseHandLabel: { id: 'app.actionsBar.emojiMenu.raiseHandLabel', description: 'label for raise hand status', }, lowerHandLabel: { id: 'app.actionsBar.emojiMenu.lowerHandLabel', description: 'label for lower hand', }, }); class RaiseHandDropdown extends PureComponent { getAvailableActions() { const { getEmojiList, setEmojiStatus, intl, } = this.props; const actions = []; const statuses = Object.keys(getEmojiList); statuses.forEach((s) => { actions.push({ key: s, label: intl.formatMessage({ id: `app.actionsBar.emojiMenu.${s}Label` }), onClick: () => { setEmojiStatus(s); }, icon: getEmojiList[s], }); }); return actions; } renderRaiseHandButton() { const { intl, setEmojiStatus, currentUser, shortcuts, } = this.props; let btnLabel; let btnEmoji; if (currentUser.emoji === 'none') { btnEmoji = 'raiseHand'; btnLabel = intlMessages.raiseHandLabel; } else if (currentUser.emoji === 'raiseHand') { btnEmoji = 'none'; btnLabel = intlMessages.lowerHandLabel; } else { btnEmoji = 'none'; btnLabel = intlMessages.clearStatusLabel; } return (