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

SpeakerStatsLabel.tsx 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React from 'react';
  2. import { useDispatch, useSelector } from 'react-redux';
  3. import { IReduxState } from '../../../app/types';
  4. import { openDialog } from '../../../base/dialog/actions';
  5. import { IconConnection } from '../../../base/icons/svg';
  6. import Label from '../../../base/label/components/web/Label';
  7. import { COLORS } from '../../../base/label/constants';
  8. import { getParticipantCount } from '../../../base/participants/functions';
  9. import { SpeakerStats } from '../../../speaker-stats';
  10. import { isSpeakerStatsDisabled } from '../../../speaker-stats/functions';
  11. /**
  12. * ParticipantsCount react component.
  13. * Displays the number of participants and opens Speaker stats on click.
  14. *
  15. * @class ParticipantsCount
  16. */
  17. function SpeakerStatsLabel() {
  18. const conference = useSelector((state: IReduxState) => state['features/base/conference'].conference);
  19. const count = useSelector(getParticipantCount);
  20. const _isSpeakerStatsDisabled = useSelector(isSpeakerStatsDisabled);
  21. const dispatch = useDispatch();
  22. const onClick = () => {
  23. dispatch(openDialog(SpeakerStats, { conference }));
  24. };
  25. if (count <= 2 || _isSpeakerStatsDisabled) {
  26. return null;
  27. }
  28. return (
  29. <Label
  30. color = { COLORS.white }
  31. icon = { IconConnection }
  32. iconColor = '#fff'
  33. // eslint-disable-next-line react/jsx-no-bind
  34. onClick = { onClick }
  35. text = { `${count}` } />
  36. );
  37. }
  38. export default SpeakerStatsLabel;