Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ParticipantsPaneButton.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeParticipantsPane';
  23. icon = IconUsers;
  24. label = 'toolbar.participants';
  25. tooltip = 'toolbar.participants';
  26. toggledTooltip = 'toolbar.closeParticipantsPane';
  27. /**
  28. * Indicates whether this button is in toggled state or not.
  29. *
  30. * @override
  31. * @protected
  32. * @returns {boolean}
  33. */
  34. _isToggled() {
  35. return this.props._isOpen;
  36. }
  37. /**
  38. * Overrides AbstractButton's {@link Component#render()}.
  39. *
  40. * @override
  41. * @protected
  42. * @returns {React$Node}
  43. */
  44. render(): React$Node {
  45. return (
  46. <div
  47. className = 'toolbar-button-with-badge'>
  48. {super.render()}
  49. <ParticipantsCounter />
  50. </div>
  51. );
  52. }
  53. }
  54. /**
  55. * Maps part of the Redux state to the props of this component.
  56. *
  57. * @param {Object} state - The Redux state.
  58. * @returns {Props}
  59. */
  60. function mapStateToProps(state) {
  61. const { isOpen } = state['features/participants-pane'];
  62. return {
  63. _isOpen: isOpen
  64. };
  65. }
  66. export default translate(connect(mapStateToProps)(ParticipantsPaneButton));