Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ParticipantCounter.web.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import { getParticipantCount } from '../../base/participants';
  4. /**
  5. * React component for showing a badge with the current count of conference
  6. * participants.
  7. *
  8. * @extends Component
  9. */
  10. class ParticipantCounter extends Component {
  11. /**
  12. * {@code ParticipantCounter} component's property types.
  13. *
  14. * @static
  15. */
  16. static propTypes = {
  17. /**
  18. * The number of participants in the conference.
  19. */
  20. _count: React.PropTypes.number
  21. };
  22. /**
  23. * Implements React's {@link Component#render()}.
  24. *
  25. * @inheritdoc
  26. * @returns {ReactElement}
  27. */
  28. render() {
  29. return (
  30. <span className = 'badge-round'>
  31. <span id = 'numberOfParticipants'>
  32. { this.props._count }
  33. </span>
  34. </span>
  35. );
  36. }
  37. }
  38. /**
  39. * Maps (parts of) the Redux state to the associated
  40. * {@code ParticipantCounter}'s props.
  41. *
  42. * @param {Object} state - The Redux state.
  43. * @private
  44. * @returns {{
  45. * _count: number
  46. * }}
  47. */
  48. function _mapStateToProps(state) {
  49. return {
  50. _count: getParticipantCount(state)
  51. };
  52. }
  53. export default connect(_mapStateToProps)(ParticipantCounter);