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

Subject.js 1.4KB

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