Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Subject.js 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { getConferenceName } from '../../../base/conference/functions';
  4. import { getParticipantCount } from '../../../base/participants/functions';
  5. import { connect } from '../../../base/redux';
  6. import { isToolboxVisible } from '../../../toolbox/functions.web';
  7. import ConferenceTimer from '../ConferenceTimer';
  8. import ParticipantsCount from './ParticipantsCount';
  9. /**
  10. * The type of the React {@code Component} props of {@link Subject}.
  11. */
  12. type Props = {
  13. /**
  14. * Whether the conference timer should be shown or not.
  15. */
  16. _hideConferenceTimer: Boolean,
  17. /**
  18. * Whether the participant count should be shown or not.
  19. */
  20. _showParticipantCount: boolean,
  21. /**
  22. * Whether the conference subject should be shown or not.
  23. */
  24. _showSubject: boolean,
  25. /**
  26. * The subject or the of the conference.
  27. * Falls back to conference name.
  28. */
  29. _subject: string,
  30. /**
  31. * Indicates whether the component should be visible or not.
  32. */
  33. _visible: boolean
  34. };
  35. /**
  36. * Subject react component.
  37. *
  38. * @class Subject
  39. */
  40. class Subject extends Component<Props> {
  41. /**
  42. * Implements React's {@link Component#render()}.
  43. *
  44. * @inheritdoc
  45. * @returns {ReactElement}
  46. */
  47. render() {
  48. const { _hideConferenceTimer, _showParticipantCount, _showSubject, _subject, _visible } = this.props;
  49. return (
  50. <div className = { `subject ${_visible ? 'visible' : ''}` }>
  51. { _showSubject && <span className = 'subject-text'>{ _subject }</span>}
  52. { _showParticipantCount && <ParticipantsCount /> }
  53. { !_hideConferenceTimer && <ConferenceTimer /> }
  54. </div>
  55. );
  56. }
  57. }
  58. /**
  59. * Maps (parts of) the Redux state to the associated
  60. * {@code Subject}'s props.
  61. *
  62. * @param {Object} state - The Redux state.
  63. * @private
  64. * @returns {{
  65. * _hideConferenceTimer: boolean,
  66. * _showParticipantCount: boolean,
  67. * _showSubject: boolean,
  68. * _subject: string,
  69. * _visible: boolean
  70. * }}
  71. */
  72. function _mapStateToProps(state) {
  73. const participantCount = getParticipantCount(state);
  74. const { hideConferenceTimer, hideConferenceSubject, hideParticipantsStats } = state['features/base/config'];
  75. return {
  76. _hideConferenceTimer: Boolean(hideConferenceTimer),
  77. _showParticipantCount: participantCount > 2 && !hideParticipantsStats,
  78. _showSubject: !hideConferenceSubject,
  79. _subject: getConferenceName(state),
  80. _visible: isToolboxVisible(state) && participantCount > 1
  81. };
  82. }
  83. export default connect(_mapStateToProps)(Subject);