bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/actions-bar/raise-hand-button/component.jsx
Ramón Souza 3a531b0532
refactor: Remove the "Raise Hand" experience from the reactions bar (#21373)
* move raise hand out of reactions bar

* adjust reactions bar border-radius

* adjust button background + remove custom icon

* fixing raise hand test

* skipping raise hand test

* fixed learning dashboaard test, flaky to notification test

---------

Co-authored-by: Gabriel Porfirio <gabrielporfirio1994@gmail.com>
2024-10-14 13:16:59 -03:00

78 lines
1.9 KiB
JavaScript

import React from 'react';
import { defineMessages } from 'react-intl';
import PropTypes from 'prop-types';
import data from '@emoji-mart/data';
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
import { init } from 'emoji-mart';
import { SET_RAISE_HAND } from '/imports/ui/core/graphql/mutations/userMutations';
import { useMutation } from '@apollo/client';
import Styled from './styles';
const RaiseHandButton = (props) => {
const {
intl,
userId,
raiseHand,
shortcuts,
} = props;
// initialize emoji-mart data, need for the new version
init({ data });
const [setRaiseHand] = useMutation(SET_RAISE_HAND);
const intlMessages = defineMessages({
raiseHandLabel: {
id: 'app.actionsBar.reactions.raiseHand',
description: 'raise Hand Label',
},
notRaiseHandLabel: {
id: 'app.actionsBar.reactions.lowHand',
description: 'not Raise Hand Label',
},
});
const handleRaiseHandButtonClick = () => {
setRaiseHand({
variables: {
userId,
raiseHand: !raiseHand,
},
});
document.activeElement.blur();
};
const label = raiseHand ? intlMessages.notRaiseHandLabel : intlMessages.raiseHandLabel;
return (
<Styled.RaiseHandButton
data-test="raiseHandBtn"
icon="hand"
label={intl.formatMessage(label)}
description="Reactions"
onKeyPress={() => { }}
onClick={() => handleRaiseHandButtonClick()}
color={raiseHand ? 'primary' : 'default'}
accessKey={shortcuts.raisehand}
hideLabel
circle
size="lg"
/>
);
};
const propTypes = {
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
userId: PropTypes.string.isRequired,
raiseHand: PropTypes.bool,
shortcuts: PropTypes.shape({
raisehand: PropTypes.string,
}).isRequired,
};
RaiseHandButton.propTypes = propTypes;
export default withShortcutHelper(RaiseHandButton, ['raiseHand']);