Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

RaisedHandsCountLabel.tsx 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. import Tooltip from '../../../base/tooltip/components/Tooltip';
  9. import { open as openParticipantsPane } from '../../../participants-pane/actions.web';
  10. const useStyles = makeStyles()(theme => {
  11. return {
  12. label: {
  13. backgroundColor: theme.palette.warning02,
  14. color: theme.palette.uiBackground
  15. }
  16. };
  17. });
  18. const RaisedHandsCountLabel = () => {
  19. const { classes: styles, theme } = useStyles();
  20. const dispatch = useDispatch();
  21. const raisedHandsCount = useSelector((state: IReduxState) =>
  22. (state['features/base/participants'].raisedHandsQueue || []).length);
  23. const { t } = useTranslation();
  24. const onClick = useCallback(() => {
  25. dispatch(openParticipantsPane());
  26. }, []);
  27. return raisedHandsCount > 0 ? (<Tooltip
  28. content = { t('raisedHandsLabel') }
  29. position = { 'bottom' }>
  30. <Label
  31. accessibilityText = { t('raisedHandsLabel') }
  32. className = { styles.label }
  33. icon = { IconRaiseHand }
  34. iconColor = { theme.palette.icon04 }
  35. id = 'raisedHandsCountLabel'
  36. onClick = { onClick }
  37. text = { `${raisedHandsCount}` } />
  38. </Tooltip>) : null;
  39. };
  40. export default RaisedHandsCountLabel;