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

ParticipantsPaneButton.tsx 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import React from 'react';
  2. import { View, ViewStyle } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { IReduxState } from '../../../app/types';
  5. import { translate } from '../../../base/i18n/functions';
  6. import { IconUsers } from '../../../base/icons/svg';
  7. import { getParticipantCount } from '../../../base/participants/functions';
  8. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  9. import { navigate }
  10. from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
  11. import { screen } from '../../../mobile/navigation/routes';
  12. import ParticipantsCounter from './ParticipantsConter';
  13. import styles from './styles';
  14. /**
  15. * The type of the React {@code Component} props of {@link ParticipantsPaneButton}.
  16. */
  17. interface IProps extends AbstractButtonProps {
  18. /**
  19. * Participants count.
  20. */
  21. _participantsCount: number;
  22. }
  23. /**
  24. * Implements an {@link AbstractButton} to open the participants panel.
  25. */
  26. class ParticipantsPaneButton extends AbstractButton<IProps> {
  27. icon = IconUsers;
  28. label = 'toolbar.participants';
  29. /**
  30. * Handles clicking / pressing the button, and opens the participants panel.
  31. *
  32. * @private
  33. * @returns {void}
  34. */
  35. _handleClick() {
  36. return navigate(screen.conference.participants);
  37. }
  38. /**
  39. * Override the _getAccessibilityLabel method to incorporate the dynamic participant count.
  40. *
  41. * @override
  42. * @returns {string}
  43. */
  44. _getAccessibilityLabel() {
  45. const { t, _participantsCount } = this.props;
  46. return t('toolbar.accessibilityLabel.participants', {
  47. participantsCount: _participantsCount
  48. });
  49. }
  50. /**
  51. * Overrides AbstractButton's {@link Component#render()}.
  52. *
  53. * @override
  54. * @protected
  55. * @returns {React.ReactElement}
  56. */
  57. render() {
  58. return (
  59. <View style = { styles.participantsButtonBadge as ViewStyle }>
  60. { super.render() }
  61. <ParticipantsCounter />
  62. </View>
  63. );
  64. }
  65. }
  66. /**
  67. * Maps part of the Redux state to the props of this component.
  68. *
  69. * @param {Object} state - The Redux state.
  70. * @returns {IProps}
  71. */
  72. function mapStateToProps(state: IReduxState) {
  73. return {
  74. _participantsCount: getParticipantCount(state)
  75. };
  76. }
  77. export default translate(connect(mapStateToProps)(ParticipantsPaneButton));