Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

RaisedHandsCountLabel.js 1.5KB

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