2021-12-21 10:22:30 +00:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
2022-09-13 07:36:00 +00:00
|
|
|
import { makeStyles } from 'tss-react/mui';
|
2021-12-21 10:22:30 +00:00
|
|
|
|
2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState } from '../../../app/types';
|
2022-11-08 10:24:32 +00:00
|
|
|
import { IconRaiseHand } from '../../../base/icons/svg';
|
2022-09-06 17:32:20 +00:00
|
|
|
import Label from '../../../base/label/components/web/Label';
|
2022-10-19 08:42:54 +00:00
|
|
|
// eslint-disable-next-line lines-around-comment
|
2022-08-26 09:54:03 +00:00
|
|
|
// @ts-ignore
|
2021-12-21 10:22:30 +00:00
|
|
|
import { Tooltip } from '../../../base/tooltip';
|
2023-02-21 09:26:04 +00:00
|
|
|
import { open as openParticipantsPane } from '../../../participants-pane/actions.web';
|
2021-12-21 10:22:30 +00:00
|
|
|
|
2022-11-15 07:50:22 +00:00
|
|
|
const useStyles = makeStyles()(theme => {
|
2021-12-21 10:22:30 +00:00
|
|
|
return {
|
|
|
|
label: {
|
|
|
|
backgroundColor: theme.palette.warning02,
|
2023-02-03 11:31:00 +00:00
|
|
|
color: theme.palette.uiBackground
|
2021-12-21 10:22:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
const RaisedHandsCountLabel = () => {
|
2022-09-13 07:36:00 +00:00
|
|
|
const { classes: styles, theme } = useStyles();
|
2021-12-21 10:22:30 +00:00
|
|
|
const dispatch = useDispatch();
|
2022-10-20 09:11:27 +00:00
|
|
|
const raisedHandsCount = useSelector((state: IReduxState) =>
|
2021-12-21 10:22:30 +00:00
|
|
|
(state['features/base/participants'].raisedHandsQueue || []).length);
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const onClick = useCallback(() => {
|
|
|
|
dispatch(openParticipantsPane());
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
return raisedHandsCount > 0 && (<Tooltip
|
|
|
|
content = { t('raisedHandsLabel') }
|
|
|
|
position = { 'bottom' }>
|
|
|
|
<Label
|
|
|
|
className = { styles.label }
|
2022-11-08 10:24:32 +00:00
|
|
|
icon = { IconRaiseHand }
|
|
|
|
iconColor = { theme.palette.icon04 }
|
2021-12-21 10:22:30 +00:00
|
|
|
id = 'raisedHandsCountLabel'
|
|
|
|
onClick = { onClick }
|
2022-08-26 09:54:03 +00:00
|
|
|
text = { `${raisedHandsCount}` } />
|
2021-12-21 10:22:30 +00:00
|
|
|
</Tooltip>);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default RaisedHandsCountLabel;
|