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.

Subject.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { getConferenceName } from '../../../base/conference/functions';
  4. import { connect } from '../../../base/redux';
  5. import { isToolboxVisible } from '../../../toolbox';
  6. import ParticipantsCount from './ParticipantsCount';
  7. /**
  8. * The type of the React {@code Component} props of {@link Subject}.
  9. */
  10. type Props = {
  11. /**
  12. * The subject or the of the conference.
  13. * Falls back to conference name.
  14. */
  15. _subject: string,
  16. /**
  17. * Indicates whether the component should be visible or not.
  18. */
  19. _visible: boolean
  20. };
  21. /**
  22. * Subject react component.
  23. *
  24. * @class Subject
  25. */
  26. class Subject extends Component<Props> {
  27. /**
  28. * Implements React's {@link Component#render()}.
  29. *
  30. * @inheritdoc
  31. * @returns {ReactElement}
  32. */
  33. render() {
  34. const { _subject, _visible } = this.props;
  35. return (
  36. <div className = { `subject ${_visible ? 'visible' : ''}` }>
  37. <span className = 'subject-text'>{ _subject }</span>
  38. <ParticipantsCount />
  39. </div>
  40. );
  41. }
  42. }
  43. /**
  44. * Maps (parts of) the Redux state to the associated
  45. * {@code Subject}'s props.
  46. *
  47. * @param {Object} state - The Redux state.
  48. * @private
  49. * @returns {{
  50. * _subject: string,
  51. * _visible: boolean
  52. * }}
  53. */
  54. function _mapStateToProps(state) {
  55. return {
  56. _subject: getConferenceName(state),
  57. _visible: isToolboxVisible(state)
  58. };
  59. }
  60. export default connect(_mapStateToProps)(Subject);