2021-12-21 12:22:30 +02:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
2022-09-13 10:36:00 +03:00
|
|
|
import { makeStyles } from 'tss-react/mui';
|
2021-12-21 12:22:30 +02:00
|
|
|
|
2022-10-20 12:11:27 +03:00
|
|
|
import { IReduxState } from '../../../app/types';
|
2022-11-08 12:24:32 +02:00
|
|
|
import { IconRaiseHand } from '../../../base/icons/svg';
|
2022-09-06 20:32:20 +03:00
|
|
|
import Label from '../../../base/label/components/web/Label';
|
2023-03-17 12:23:51 +02:00
|
|
|
import Tooltip from '../../../base/tooltip/components/Tooltip';
|
2023-02-21 11:26:04 +02:00
|
|
|
import { open as openParticipantsPane } from '../../../participants-pane/actions.web';
|
2021-12-21 12:22:30 +02:00
|
|
|
|
2022-11-15 08:50:22 +01:00
|
|
|
const useStyles = makeStyles()(theme => {
|
2021-12-21 12:22:30 +02:00
|
|
|
return {
|
|
|
|
|
label: {
|
|
|
|
|
backgroundColor: theme.palette.warning02,
|
2023-02-03 13:31:00 +02:00
|
|
|
color: theme.palette.uiBackground
|
2021-12-21 12:22:30 +02:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const RaisedHandsCountLabel = () => {
|
2022-09-13 10:36:00 +03:00
|
|
|
const { classes: styles, theme } = useStyles();
|
2021-12-21 12:22:30 +02:00
|
|
|
const dispatch = useDispatch();
|
2022-10-20 12:11:27 +03:00
|
|
|
const raisedHandsCount = useSelector((state: IReduxState) =>
|
2021-12-21 12:22:30 +02: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 12:24:32 +02:00
|
|
|
icon = { IconRaiseHand }
|
|
|
|
|
iconColor = { theme.palette.icon04 }
|
2021-12-21 12:22:30 +02:00
|
|
|
id = 'raisedHandsCountLabel'
|
|
|
|
|
onClick = { onClick }
|
2022-08-26 12:54:03 +03:00
|
|
|
text = { `${raisedHandsCount}` } />
|
2021-12-21 12:22:30 +02:00
|
|
|
</Tooltip>);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default RaisedHandsCountLabel;
|