You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RaisedHandsCountLabel.tsx 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { Theme } from '@mui/material';
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { useDispatch, useSelector } from 'react-redux';
  5. import { makeStyles } from 'tss-react/mui';
  6. import { IReduxState } from '../../../app/types';
  7. import { IconRaisedHand } from '../../../base/icons/svg';
  8. import Label from '../../../base/label/components/web/Label';
  9. // eslint-disable-next-line lines-around-comment
  10. // @ts-ignore
  11. import { Tooltip } from '../../../base/tooltip';
  12. import { open as openParticipantsPane } from '../../../participants-pane/actions';
  13. const useStyles = makeStyles()((theme: Theme) => {
  14. return {
  15. label: {
  16. backgroundColor: theme.palette.warning02,
  17. color: theme.palette.uiBackground,
  18. marginRight: theme.spacing(1)
  19. }
  20. };
  21. });
  22. const RaisedHandsCountLabel = () => {
  23. const { classes: styles, theme } = useStyles();
  24. const dispatch = useDispatch();
  25. const raisedHandsCount = useSelector((state: IReduxState) =>
  26. (state['features/base/participants'].raisedHandsQueue || []).length);
  27. const { t } = useTranslation();
  28. const onClick = useCallback(() => {
  29. dispatch(openParticipantsPane());
  30. }, []);
  31. return raisedHandsCount > 0 && (<Tooltip
  32. content = { t('raisedHandsLabel') }
  33. position = { 'bottom' }>
  34. <Label
  35. className = { styles.label }
  36. icon = { IconRaisedHand }
  37. iconColor = { theme.palette.uiBackground }
  38. id = 'raisedHandsCountLabel'
  39. onClick = { onClick }
  40. text = { `${raisedHandsCount}` } />
  41. </Tooltip>);
  42. };
  43. export default RaisedHandsCountLabel;