You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ParticipantsPaneButton.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // @flow
  2. import React from 'react';
  3. import { translate } from '../../../base/i18n';
  4. import { IconUsers } from '../../../base/icons';
  5. import { connect } from '../../../base/redux';
  6. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  7. import ParticipantsCounter from './ParticipantsCounter';
  8. /**
  9. * The type of the React {@code Component} props of {@link ParticipantsPaneButton}.
  10. */
  11. type Props = AbstractButtonProps & {
  12. /**
  13. * Whether or not the participants pane is open.
  14. */
  15. _isOpen: boolean,
  16. };
  17. /**
  18. * Implementation of a button for accessing participants pane.
  19. */
  20. class ParticipantsPaneButton extends AbstractButton<Props, *> {
  21. accessibilityLabel = 'toolbar.accessibilityLabel.participants';
  22. icon = IconUsers;
  23. label = 'toolbar.participants';
  24. tooltip = 'toolbar.participants';
  25. /**
  26. * Indicates whether this button is in toggled state or not.
  27. *
  28. * @override
  29. * @protected
  30. * @returns {boolean}
  31. */
  32. _isToggled() {
  33. return this.props._isOpen;
  34. }
  35. /**
  36. * Overrides AbstractButton's {@link Component#render()}.
  37. *
  38. * @override
  39. * @protected
  40. * @returns {React$Node}
  41. */
  42. render(): React$Node {
  43. return (
  44. <div
  45. className = 'toolbar-button-with-badge'>
  46. {super.render()}
  47. <ParticipantsCounter />
  48. </div>
  49. );
  50. }
  51. }
  52. /**
  53. * Maps part of the Redux state to the props of this component.
  54. *
  55. * @param {Object} state - The Redux state.
  56. * @returns {Props}
  57. */
  58. function mapStateToProps(state) {
  59. const { isOpen } = state['features/participants-pane'];
  60. return {
  61. _isOpen: isOpen
  62. };
  63. }
  64. export default translate(connect(mapStateToProps)(ParticipantsPaneButton));