Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

RaisedHandsCountLabel.tsx 1.6KB

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